My application is building a 3D scatter plot using multiple datasets / curves. I'd like to make each dataset a different color like in the 'Color Based on Data set' option in the scatter plot options.
I've tried a several different combinations of the following commands but without success. How do I duplicate this functionality using DplotLib?
[Color]
[ContourColorScheme]
[ContourCustomColors]
[SelectCurve]
Also, would it be possible to set custom colors / ranges for each dataset when ContourColorScheme is 2?
Thanks.
Color Based on Dataset
Moderator: DPlotAdmin
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
ColorBasis(1)
0=color based on Z
1=different colors for each data set
2=color based on depth into view
and... whoops, you caught me. This command isn't documented. It will be in the next release.
ContourColorScheme(2)
to use these custom colors:
ContourCustomColors(0x000000FF,0x0000FF00,0x00FF0000)
will use red for the first set, green for the 2nd, blue for the 3rd.
If by this:
0=color based on Z
1=different colors for each data set
2=color based on depth into view
and... whoops, you caught me. This command isn't documented. It will be in the next release.
ContourColorScheme(2)
to use these custom colors:
ContourCustomColors(0x000000FF,0x0000FF00,0x00FF0000)
will use red for the first set, green for the 2nd, blue for the 3rd.
If by this:
You mean that you want more than 1 color for a single data set and that group of colors to be different than that used by any other data set - no, there's no way to do that currently.Also, would it be possible to set custom colors / ranges for each dataset when ContourColorScheme is 2?
Visualize Your Data
support@dplot.com
support@dplot.com
-
- Posts: 5
- Joined: Tue May 17, 2005 1:01 pm
That's what I meant. Didn't think it was possible but doesn't hurt to ask.DPlotAdmin wrote:
If by this:You mean that you want more than 1 color for a single data set and that group of colors to be different than that used by any other data set - no, there's no way to do that currently.Also, would it be possible to set custom colors / ranges for each dataset when ContourColorScheme is 2?
I've got another question for you.
What's the proper way to work with multiple data sets?
Here's what I'm doing.
Init various properties of the DPlot object
objDPlot.DataFormat = DATA_3DS
objDPlot.MaxCurves = 2
objDPlot.MaxPoints = 340
objDPlot.NumCurves = 2
objDPlot.NP(0) = 60
objDPlot.NP(1) = 6
ReDim my array (2,59)
Fill my array with 60 triplet values.
Call DPlot_Plot() with these 60 triplets
ReDim my array (2,5)
Fill array with 6 triplet values
Call DPlot_AddData() passing NumPts=6 & Curve=2
When I copy the data for Curve #2 I have 12 points with the first six being nearly 0,0,0. This makes sense because I just added 6 points.
I've also tried commanding [SelectCurve(2)] and calling DPlot_Plot() a second time but this results in the overwritting of the values for my first curve.
Back to the AddData method
I tried setting .NP(1)=0 but this generates multiple errors.
I then tried setting NumCurves=1 and using AddData to generate a second curve but this generates an empty plot and crashes DPlotJr.
Thanks for your help.
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
The easiest way is to do it all at once, if that's convenient.
ReDim my array(2,65)
with the first 3x60 elements in the first data set and the remaining 3x6 elements in the 2nd data set. If you can decipher C you should look at ctest.c, which plots 3 data sets with one call to DPlot_Plot with option #6.
If you can't do that for whatever reason, then your objDPlot structure should be set up ONLY for the data being passed thru DPlot_Plot:
objDPlot.DataFormat = DATA_3DS
objDPlot.MaxCurves = 2
objDPlot.MaxPoints = 60 ' or more
objDPlot.NumCurves = 1 ' because you're only sending 1 data set
objDPlot.NP(0) = 60
objDPlot.NP(1) = 0 ' not needed, just want to make sure this is clear
You should then be able to call DPlot_AddData with NumPts=6 and Curve=2.
If you try that and it doesn't work let me know and I'll put together a VB version of that test that uses DPlot_AddData instead of sending all 3 sets at once.
ReDim my array(2,65)
with the first 3x60 elements in the first data set and the remaining 3x6 elements in the 2nd data set. If you can decipher C you should look at ctest.c, which plots 3 data sets with one call to DPlot_Plot with option #6.
If you can't do that for whatever reason, then your objDPlot structure should be set up ONLY for the data being passed thru DPlot_Plot:
objDPlot.DataFormat = DATA_3DS
objDPlot.MaxCurves = 2
objDPlot.MaxPoints = 60 ' or more
objDPlot.NumCurves = 1 ' because you're only sending 1 data set
objDPlot.NP(0) = 60
objDPlot.NP(1) = 0 ' not needed, just want to make sure this is clear
You should then be able to call DPlot_AddData with NumPts=6 and Curve=2.
If you try that and it doesn't work let me know and I'll put together a VB version of that test that uses DPlot_AddData instead of sending all 3 sets at once.
Visualize Your Data
support@dplot.com
support@dplot.com
-
- Posts: 5
- Joined: Tue May 17, 2005 1:01 pm
Just to make sure I understand.
If the size of the array passed in through the DPlot_Plot call is larger than the first number of points in the first curve it will overflow into the next curve, so on and so on....
That sounds simple enough. I'll give it a try tomorrow.
Thanks again for the excellent help.
If the size of the array passed in through the DPlot_Plot call is larger than the first number of points in the first curve it will overflow into the next curve, so on and so on....
That sounds simple enough. I'll give it a try tomorrow.
Thanks again for the excellent help.
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
Yes, that is correct.If the size of the array passed in through the DPlot_Plot call is larger than the first number of points in the first curve it will overflow into the next curve, so on and so on....
You're quite welcome.Thanks again for the excellent help.
BTW I'm currently working on a 4D scatter plot that will almost, though not quite, do what you asked about earlier. X,Y,Z and some 4th dimension that you can scale the color by. You still won't be able to have a separate color palette for each data set, but you can use different symbols for each data set to distinguish them.
Visualize Your Data
support@dplot.com
support@dplot.com