T O P I C R E V I E W |
jgg824 |
Posted - 09/02/2015 : 04:22:43 AM Origin Ver. and Service Release (Select Help-->About Origin): OriginPro9.1.0 (32-bit) Sr3 Operating System:7 SP1
Hi,
I want to do some automatic plotting assigned to a button but I can't get my Labtalk Script quite right. I'm trying to plot an xy graph columns B and C2 in a single graph with a saved theme, and the columns C5 vs C8, C12 vs C15 etc in a combined graph with another theme.
Can anyone help please? |
3 L A T E S T R E P L I E S (Newest First) |
cpyang |
Posted - 09/07/2015 : 02:14:35 AM Your code is not using theme at all. The code was trying to plot into an existing graph, but you first load a default template, just not right.
To use a theme you have saved, you should use the ApplyFormat command, see
http://www.originlab.com/doc/OriginC/ref/OriginObject-ApplyFormat
What you should do is to prepare templates, then use the code Sean posted. Themes are files you saved, and templates are too, so why do you need to use theme when template can work much better.
CP
|
jgg824 |
Posted - 09/06/2015 : 05:45:06 AM Hi Sean,
Thanks for your reply. Your solution didn't suit my problem and I realised I was very clear about what I want to do.
I've tried to set the code below to a button to plot all of those graphs in one go, after I've imported the necessary data from excel. I made it by adapting the code I grabbed from another forum topic in the code builder.
The term in [] is the name for each graph, I wasn't sure how to refer to the theme.
Here is my code that doesn't quite work, and I'm not sure why.
{win -t P;} //create new empty graph //doc -e W //loop all workbooks in the OPJ (This may be useful later)
{ //Plot Tc plotxy iy:=(2,4) plot:=202 ogl:=[Pre-etch Tc]1!; //Plot these in the same graph with a custom theme stored in theme organiser plotxy iy:=(col(c5),col(c8)) plot:=202 ogl:=[Pre-etch Magnetisation]1!; plotxy iy:=(col(c12),col(c15)) plot:=202 ogl:=[Pre-etch Magnetisation]1!; plotxy iy:=(col(c19),col(c22)) plot:=202 ogl:=[Pre-etch Magnetisation]1!; plotxy iy:=(col(c26),col(c29)) plot:=202 ogl:=[Pre-etch Magnetisation]1!;
//Plot these as separate graphs all with another custom theme stored in theme organiser plotxy iy:=(col(c5),col(c9)) plot:=202 ogl:=[Jc 2K]1!; plotxy iy:=(col(c12),col(c16)) plot:=202 ogl:=[Jc 4.2K]1!; plotxy iy:=(col(c19),col(c23)) plot:=202 ogl:=[Jc 10K]1!; plotxy iy:=(col(c26),col(c30)) plot:=202 ogl:=[Jc 77K]1!; }
Does that make more sense?
Kind Regards,
Jonathan
|
SeanMao |
Posted - 09/02/2015 : 05:24:04 AM Hi,
I guess the "theme" you are referring to is Graph Template. If so, you can run the following LabTalk command:
plotxy iy:=(col(B),col(C2)) plot:=201 ogl:=[<new template:=MyScatter name:=MyScatterGraph>];
The above code will plot column C2 (short name) vs column B (short name) into template MyScatter and name the newly created graph window as MyScatterGraph.
Similarly, for another graph the syntax would be: plotxy iy:=((col(C8),col(C5)),(col(C15),col(C12))) plot:=200 ogl:=[<new template:=MyLine name:=MyLineGraph>];
Give it a try and see how it goes!
Regards!
Sean
OriginLab Tech. Service
|
|
|