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

66de250

China
34 Posts

Posted - 07/18/2025 :  02:08:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver 2021. and Service Release (Select Help-->About Origin):
Operating System: win11
I have 11 columns of data. The first column is x. Plot all the data onto one layer. How should I set the legend to display only the long names of the second and last columns through the LabTalk language or the X-Function command line only? That is, the legend only has the second column and the last column

ChaoC

USA
201 Posts

Posted - 07/18/2025 :  09:25:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can use the label command to replace the legend syntax.
E.g. label -n Legend \l(1) %(1,@LL)%(CRLF)\l(10) %(10,@LL);

See:

Go to Top of Page

66de250

China
34 Posts

Posted - 07/19/2025 :  08:20:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by ChaoC

Hello,

You can use the label command to replace the legend syntax.
E.g. label -n Legend \l(1) %(1,@LL)%(CRLF)\l(10) %(10,@LL);

See:


Thank you very much for your help! How can the second legend be determined based on the number of columns in the worksheet? That is to say, the number of my data columns is no longer a definite number, but I still need to use scripts to create a legend with only the first and last columns

Go to Top of Page

ChaoC

USA
201 Posts

Posted - 07/21/2025 :  10:41:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can use layer- c to count the number of plots in the layer:
https://www.originlab.com/doc/en/LabTalk/ref/Layer_Options_for_Plot#-c

E.g.

layer -c;
label -n Legend \l(1) %(1,@LL)%(CRLF)\l(%(count)) %(count,@LL);

Best,
Chao
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