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
 positioning a legend
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

psgst

UK
Posts

Posted - 09/25/2006 :  4:50:35 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
hey folks,

i'm trying to position a legend using a labtalk script. so far i've tried manipulating it like a label with:


legend.x1 = 500;
legend.y1 = 3790;


but i can't see the legend anywhere on my screen. no matter what co-ordinates i try it never appears, and sometimes no data at all appears.

where am i going wrong?

zachary_origin

China
Posts

Posted - 09/26/2006 :  01:39:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You have moved the legend out of the graph.
These scripts set the position of the legend relative to the axis in the graph. You can type legend.x1= to get the current position, then move it relatively using legend.x1 = legend.x1 + 10.


Zachary
OriginLab Technical Services.
Go to Top of Page

psgst

UK
Posts

Posted - 09/26/2006 :  10:58:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks! that worked great. i do have a couple of follow on questions though:

1) i am currently plotting a line graph but am interested in a line and symbol graph, is there a method of achieving this that is as simple as run.section(Plot,Line); ?

2) once a line and symbol graph is plotted, how do you change the size of the symbols and standardise them so that they are all square or circle or whatever, in labtalk? (basically so that each seperate line has the same symbol as every other line, just different coloured lines).

cheers.

Go to Top of Page

zachary_origin

China
Posts

Posted - 09/26/2006 :  10:16:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

1) i am currently plotting a line graph but am interested in a line and symbol graph, is there a method of achieving this that is as simple as run.section(Plot,Line); ?


Yes, it is run.section(plot, LineSymbol)

Hints: you can hold down CTRL+SHIFT and click on the button in the toolbar to see the LabTalk command for the button. E.g. here click on the Line+Symbol button, you can see it goes to LineSymbol section of the Plot.ogs.

quote:

2) once a line and symbol graph is plotted, how do you change the size of the symbols and standardise them so that they are all square or circle or whatever, in labtalk? (basically so that each seperate line has the same symbol as every other line, just different coloured lines).




set data1_B -k 8; // set the shape as star, data1_B is the dataset name of the plot
set data1_B -cse 2; //set the color as red, data1_B is the dataset name of the plot

For more information, see Help:Programming, LabTalk Language Reference:Command Reference:Alphabetical Listing:List for the List script.


Edited by - zachary_origin on 09/26/2006 10:19:03 PM
Go to Top of Page

psgst

UK
Posts

Posted - 09/27/2006 :  05:11:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
ok so i put those into my code and added the set -z option as well but i'm seeing absolutely no difference. the shapes differ from line to line, the colours won't change, and the symbol size won't change either. here is the code i am using:


if (fCount => 1) {
set bWks_A -k 2; // change shape to circle
set bWks_A -cse 1; // line colour =
set bWks_A -z 3; // symbol size of 3
} if (fCount => 2) {
set bWks_B -k 2;
set bWks_B -cse 2; // line colour =
set bWks_B -z 3; // symbol size of 3
} if (fCount == 3) {
set bWks_C -k 2;
set bWks_C -cse 3; // line colour =
set bWks_C -z 3; // symbol size of 3
}


i've tried placing it before the plot, and i've tried placing it after. am i going wrong?

Go to Top of Page

larry_lan

China
Posts

Posted - 09/27/2006 :  07:18:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Andy:

the problem is the symbol you choose.

set dataset -c color#
will set the plot line color and symbol edge color following the color palette while
set dataset -cse color#
set the plot symbol fill color following the color palette and
set dataset -csf color#
set the plot symbol fill color following the color palette.

If you use
set bWks_B -k 2;
to specify the symbol type, the shape is solid, so the edge and filled color are unavailable. So may be you can change your scripts like:
if(fCount >= 1 && fCount <2)
{
set bWks_B -k 2;
set bWks_B -c 1;
set bWks_b -z 3;
} else if (fCount >= 2 && fCount < 3)
{
set bWks_B -k 2;
set bWks_B -c 2;
set bWks_b -z 3;
} else if (fCount == 3)
{
set bWks_B -k 2;
set bWks_B -c 3;
set bWks_b -z 3;
}


More information please referance to the Set command of LabTalk help file.

Larry
OriginLab Technical Services

Edited by - larry_lan on 09/27/2006 07:26:39 AM
Go to Top of Page

psgst

UK
Posts

Posted - 09/27/2006 :  08:18:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Those changes haven't had any effect, I still get differing shapes of symbol between lines, and the size still hasn't changed. I really can't get my head around why that might be.

Go to Top of Page

larry_lan

China
Posts

Posted - 09/27/2006 :  9:32:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi:

In your script, bWks_A is X column or Y column? I think you can send your data and all of your scripts to tech@originlab.com and we will look into it.

Larry
OriginLab Technical Services
Go to Top of Page

psgst

UK
Posts

Posted - 09/28/2006 :  04:10:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
bWks_A is a Y column, all of the columns on that worksheet are, with X being provided by the number of rows each column has.

Does that make any difference?

I'd rather not send my script and data unless absolutely necessary.

Go to Top of Page

larry_lan

China
Posts

Posted - 09/28/2006 :  05:01:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
May be the problem is:

1. The window you want to change the symbol is not the active window.
2. Try to refresh the graph.

In the grahp below, I try to highlight column A and run the script, which save in test.ogs, it do change the symbol. So could you consider the above problem and try to improve your scripts?

scripts:

run.section(plot, LineSymbol);
fCount = 1.5;
if(fCount >= 1 && fCount <2)
{
set bWks_A -k 2;
set bWks_A -c 1;
set bWks_A -z 3;
} else if (fCount >= 2 && fCount < 3)
{
set bWks_B -k 2;
set bWks_B -c 2;
set bWks_B -z 3;
} else if (fCount == 3)
{
set bWks_C -k 2;
set bWks_C -c 3;
set bWks_C -z 3;
}


Any way, it would be better to know what happend before running these scripts.

Larry
OriginLab Technical Services

Edited by - larry_lan on 09/28/2006 05:16:18 AM
Go to Top of Page

psgst

UK
Posts

Posted - 10/02/2006 :  06:21:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
fCount is the variable storing the result of fdlog.MultiOpen.Count - for each file opened there is one column of data in the worksheet bWks.

quote:
1. The window you want to change the symbol is not the active window.
2. Try to refresh the graph.


Considering these problems my replies are:

1. The active window is the graph.
2. How do you refresh a graph?

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/02/2006 :  07:42:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
How do you refresh a graph?

Use the Refresh button or doc -uw.

Mike Buess
Origin WebRing Member
Go to Top of Page

psgst

UK
Posts

Posted - 10/02/2006 :  08:55:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Still not working.

I should perhaps also say that this graph is being placed onto a 'layout' report as well, does that make a difference? The placement happens after I've been setting the graph properties though so I wouldn't have thought so.

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