DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Color Based on Dataset

 
Post new topic   Reply to topic    DPlot Forum Index -> Basic
View previous topic :: View next topic  
Author Message
DPlot_User



Joined: 17 May 2005
Posts: 5

PostPosted: Tue May 17, 2005 1:13 pm    Post subject: Color Based on Dataset Reply with quote

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.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Tue May 17, 2005 1:33 pm    Post subject: Reply with quote

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:
Quote:
Also, would it be possible to set custom colors / ranges for each dataset when ContourColorScheme is 2?

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.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlot_User



Joined: 17 May 2005
Posts: 5

PostPosted: Tue May 17, 2005 2:21 pm    Post subject: Reply with quote

DPlotAdmin wrote:


If by this:
Quote:
Also, would it be possible to set custom colors / ranges for each dataset when ContourColorScheme is 2?

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.


That's what I meant. Didn't think it was possible but doesn't hurt to ask.


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.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Tue May 17, 2005 2:56 pm    Post subject: Reply with quote

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.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlot_User



Joined: 17 May 2005
Posts: 5

PostPosted: Tue May 17, 2005 9:03 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Tue May 17, 2005 9:15 pm    Post subject: Reply with quote

Quote:
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....


Yes, that is correct.

Quote:
Thanks again for the excellent help.


You're quite welcome.

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Basic All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group