Author |
Topic |
|
ovince
Yugoslavia
Posts |
Posted - 09/17/2006 : 4:52:38 PM
|
Hi All,
I have 3 plots on the graph and I would like to make a legend with message that explains what is what. Could somebody direct me how to do it
Thanks Oliver |
|
Deanna
China
Posts |
Posted - 09/17/2006 : 10:09:11 PM
|
How about this:
//Create a legend for all plots legend -s;
//Set the legend text legend.text$="\l(1) description for plot 1 \l(2) description for plot 2 \l(3) description for plot 3";
Deanna OriginLab GZ Office |
|
|
ovince
Yugoslavia
Posts |
Posted - 09/18/2006 : 12:59:12 AM
|
hello,
thanks.
Are the options for legend described somewhere in Origin's help? I tryed to find with Search but no success.
I would like to positione the legend and create a border. How to do it?
oliver |
|
|
larry_lan
China
Posts |
Posted - 09/18/2006 : 01:37:19 AM
|
Hi Oliver:
The help file didn't list all of the object properties, however, you can type
legend.=
in the command window to show the properties for legend object. So to position the legend and add border, try the following scripts:
legend.x = value of x coordinates legend.y = value of y coordinates legend.background = 1; // Add border
Larry OriginLab GZ Office |
|
|
ovince
Yugoslavia
Posts |
Posted - 09/18/2006 : 01:56:43 AM
|
Thanks Deanna and Larry. |
|
|
AMHumphries
UK
Posts |
Posted - 09/20/2006 : 03:23:55 AM
|
I'm working on a legend myself, however I am trying to use data from a worksheet to insert into the legend (each worksheet processed has a metadata tag on it). The number of worksheets are variable, and so it has proved rather difficult. So far I am doing something along these lines:
loop (jj, 1, fileCount) { %J = Sheet($jj)_J; %K = %J\l; }
...(and further down)...
// create the legend legend -s; legend.text$ = %K; legend.background = 1; // add a border
Which obviously does not work. I am finding it difficult to get to grips with the way Origin manipulates strings. Is there a way of doing this that works so that it remains in the same format and there are not too many changes to the rest of the script?
|
|
|
larry_lan
China
Posts |
Posted - 09/20/2006 : 04:53:30 AM
|
Hi Andrew:
The syntax to specify a legend that includes data sets from a layer is:
\L(LayerNumber.DataPlotNumber,DataPointNumber) DataPlotName
For Example:
\L(1) Data1_B
means the first dataset of the current layer, and name it Data1_B. So may be you can change your scripts as:
loop (jj, 1, fileCount) { %J = Sheet$(jj)_J; // Note that $() is used for numeric to string conversion; %K = "\L($(jj)) %J"; // Need to quote the string because there is space between \L($(jj)) and %J; } ..... // Create the legend legend -s; legend.text$ = %K; legend.background = 1;
Larry OriginLab GZ Office
Edited by - larry_lan on 09/20/2006 04:55:58 AM |
|
|
AMHumphries
UK
Posts |
Posted - 09/20/2006 : 09:10:00 AM
|
Thanks for the reply Larry, however when using the code that you provided me instead of getting "1239123_JUL_04_2006_10_20_39" which is an example of the meta-data, I simply get "Sheet1_J" on the legend.
|
|
|
AMHumphries
UK
Posts |
Posted - 09/20/2006 : 11:38:50 AM
|
Oh and the code you gave me is also over-writing the contents of %K on each pass so that instead of having several legend metadata tags, I have only one... the last one processed.
|
|
|
AMHumphries
UK
Posts |
Posted - 09/21/2006 : 11:41:32 AM
|
Bump.
Does anyone have any idea why this is happening?
Is it not possible to append to a variable in Origin?
|
|
|
Mike Buess
USA
3037 Posts |
Posted - 09/21/2006 : 3:10:42 PM
|
Hi Oliver,
quote: Does anyone have any idea why this is happening?
%K is overwritten by the line %K = "\L($(jj)) %J". If you want to append to previous %K try this...
%Z=""; loop (jj, 1, fileCount) { %J = Sheet$(jj)_J; // Note that $() is used for numeric to string conversion; %K = "\L($(jj)) %J"; // Need to quote the string because there is space between \L($(jj)) and %J; if(jj==1) %Z=%K; else { %Z=%Z %K; }; }; ..... // Create the legend legend -s; legend.text$ = %Z; legend.background = 1;
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 09/21/2006 3:13:58 PM |
|
|
AMHumphries
UK
Posts |
Posted - 09/25/2006 : 06:58:39 AM
|
I am still getting Sheet1_J (Sheet2_J, Sheet3_J, etc.) instead of the contents of Sheet1's J column cell 1 (Sheet2's, Sheet3's, etc.). Should I be quoting %K = Sheet$(jj)_J; in any particular way? The data is alphanumeric if that helps. Probably with underscores too. Is %K able to manipulate non-numeric data like this?
Also the legend formatting leaves preceding tabs for each new line, is there a way to control this formatting?
|
|
|
Mike Buess
USA
3037 Posts |
Posted - 09/25/2006 : 08:03:47 AM
|
Sorry, but this is the first time you've indicated that you want the contents of a cell rather than the column name. Use this...
%J=Sheet$(jj)_J[1]$;
Each new line will start with a plot symbol rather than a tab. If you don't wan't a space between plot symbol and the next letter just remove the space between \L($(jj)) and %J...
%K = "\L($(jj))%J";
...If you don't want a plot symbol just use %K=%J.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 09/25/2006 08:18:55 AM |
|
|
SvenP
29 Posts |
Posted - 08/23/2010 : 05:04:19 AM
|
quote: Originally posted by larry_lan
The help file didn't list all of the object properties, however, you can type
legend.=
in the command window to show the properties for legend object.
Hmm...nothing happens. |
|
|
|
Topic |
|