The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 DoubleY plot with different color
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

algarhyplasma

USA
4 Posts

Posted - 10/30/2023 :  12:41:35 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm trying to plot doubleY graph with 2 layers or 2Ys Y-Y graph.
I'm using the following code.
But I need to make a different color for each line.
Does anyone know how to change the color of each line?


string filePath$ = "C:\Users\User1\Desktop\Alldata.xlsx";
newbook;
impExcel -o %C filePath$;

wks.col1.type = 2;

for (int i = 2; i <= 5; i++) {
wks.col(i).type = 3;
}


wks.col7.type = 4;
for (int i = 8; i <= 14; i++) {
wks.col(i).type = 5; // Set the Y2-axis type to Y
}

string bkname$ = page.name$;
string shname$ = layer.name$;
plotxy iy:=((1,2:5)) plot:=200 ogl:=[<new template:=doubleY>];
plotxy iy:=[bkname$]shname$!((7,8:12)) plot:=200 ogl:=2;

mahmoud

ChaoC

USA
174 Posts

Posted - 10/31/2023 :  08:49:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can use the 'set' command to modify the attributes of a data plot.

Please see: https://www.originlab.com/doc/LabTalk/guide/Formatting-Graphs#Data_Plot_Properties

Best,
Chao
Go to Top of Page

algarhyplasma

USA
4 Posts

Posted - 10/31/2023 :  12:35:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much for your kind help.
I don't know exactly how to use "Set" to change the color of each line.
Could you please give me an example of how to change the color of each line?

best regards
Mahmoud



quote:
Originally posted by ChaoC

Hello,

You can use the 'set' command to modify the attributes of a data plot.

Please see: https://www.originlab.com/doc/LabTalk/guide/Formatting-Graphs#Data_Plot_Properties

Best,
Chao



mahmoud
Go to Top of Page

ChaoC

USA
174 Posts

Posted - 10/31/2023 :  2:33:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

The link provides an example:

// Change plot line color
sec -p 1;
set %C -cl color(red);


You can go to this page to see more options and their examples:
https://www.originlab.com/doc/en/LabTalk/ref/Set-cmd#Option_for_Data_Plots

For your case, please see the options "-c" and "-cl"

Best,
Chao
Go to Top of Page

algarhyplasma

USA
4 Posts

Posted - 10/31/2023 :  4:58:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, Chao,
I already tried to use -c and -cl but unfortunately, it can't change the color of each line, it just changes the color of the whole layer.

Regards,

quote:
Originally posted by ChaoC

Hello,

The link provides an example:

// Change plot line color
sec -p 1;
set %C -cl color(red);


You can go to this page to see more options and their examples:
https://www.originlab.com/doc/en/LabTalk/ref/Set-cmd#Option_for_Data_Plots

For your case, please see the options "-c" and "-cl"

Best,
Chao



mahmoud
Go to Top of Page

ChaoC

USA
174 Posts

Posted - 11/01/2023 :  09:55:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by algarhyplasma

it can't change the color of each line, it just changes the color of the whole layer.




You will have to set your grouped plots to be independent.
See: https://www.originlab.com/doc/en/LabTalk/ref/Options_for_Other_Options#-gm



Best,
Chao
Go to Top of Page

algarhyplasma

USA
4 Posts

Posted - 11/01/2023 :  1:40:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Chao,
It works. I really appreciate your help. Thank you so much.

Mahmoud


quote:
Originally posted by ChaoC

quote:
Originally posted by algarhyplasma

it can't change the color of each line, it just changes the color of the whole layer.




You will have to set your grouped plots to be independent.
See: https://www.originlab.com/doc/en/LabTalk/ref/Options_for_Other_Options#-gm



Best,
Chao



mahmoud
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 © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000