The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Plot colors
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Francesco84

Italy
18 Posts

Posted - 05/13/2019 :  12:00:09 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 2019b
Operating System: Windows 10

Good evening,
I would like to ask a question.

I have a worksheet with 100 columns; the odd ones are X, while the even ones are Y.

I have to do a graph with all the functions, which are therefore 50.

I use this method:
for (int i=1; i<=50; i++)
{
plotxy iy:=[Book1]1!(col($((i*2)-1)),col($(i*2))) plot:=200 ogl:=[Graph1]1!
}

What is the best way to assign a different color to each chart?

Thank you
Francesco

yuki_wu

713 Posts

Posted - 05/13/2019 :  10:42:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Francesco,

After plot the data as you mentioned, we can group all the plots to set different color automaticall:
layer -g 1 50;

If you have already set the plot designation as XYXYXY… in worksheet, we can plot all columns in that worksheet directly and the plots will be set in different colors:
plotxy iy:=(?,1:end) plot:=200;

Regards,
Yuki
OriginLab
Go to Top of Page

Francesco84

Italy
18 Posts

Posted - 05/14/2019 :  08:29:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuky,
Thanks for the reply.

The problem is that with the method you told me only 12 colors are generated for the curves, then they start again from the first one.

Isn't there a way to add more colors?

Thank you,
Francesco
Go to Top of Page

yuki_wu

713 Posts

Posted - 05/14/2019 :  11:24:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Francesco,

To set more colors for the plots, you need to use the command below:

set DatasetName -c value;

so that you could set color by RGB value or HTML value, which have more choices.
https://www.originlab.com/doc/LabTalk/ref/Options_for_DataPlots#-c

Regards,
Yuki
OriginLab
Go to Top of Page

Francesco84

Italy
18 Posts

Posted - 05/24/2019 :  03:45:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Yuki,

following your advice, I defined an array of colors to use for the plots.

StringArray Colors;
Colors.Add("color(255,0,0)");
Colors.Add("color(0,255,0)");
.
.
.

for (int i=1; i<=50; i++)
{
plotxy iy:=[Book1]1!(col($((i*2)-1)),col($(i*2))) plot:=200 ogl:=[Graph1]1!;

layer1.plot = i;

set %C -c %(Colors.GetAt(i)$);
}

Regards,
Francesco
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2008 Originlab Corporation Go To Top Of Page
Snitz Forums 2000