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
 multi-line x-tick labels
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

byrdin

France
18 Posts

Posted - 03/14/2005 :  11:12:05 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7
Operating System:w95

after there's no way of entering multi-line text in worksheet cells,
is there a way of directly entering multi-line tick labels via labtalk?
(my labels are just a bit too large, even in the smallest readable font)
thanx for suggestions

Mike Buess

USA
3037 Posts

Posted - 03/14/2005 :  3:33:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Here's a rather inelegant method that might work. It involves splitting your multiline labels and putting each line in a separate column. I'll assume that your labels have two lines. If your data are in the first two columns, A(X) and B(Y), then add columns C and D and enter the labels like this...

C(Y) D(Y)
line1 line2
line1 line2
etc. etc.

Next plot your data and run the following script from the script window. (Your graph must be active.)

yoff=0.05; // Y offset for your tick labels (you'll need to adjust)
firsttick=layer.x.firsttick; // x value at first tick
tickinc=layer.x.inc; // tick increment
LAYER.X.showlabels=0; // hide the numeric tick labels (in case you haven't already)
%W=%[%C,'_']; // get the wks name
for (i=1;i>0;i++) {
%L=%W_C[i]$; // line 1
if(%L=="") break; // stop when you run out of labels
%M=%W_D[i]$; // line 2
label -s -sa -n L$(i) "%L\n%M"; // create label
L$(i).x=firsttick+(i-1)*tickinc; // move label to tick's X position
L$(i).y=y1-yoff-L$(i).dy/2; // move it below axis
};

Mike Buess
Origin WebRing Member
Go to Top of Page

byrdin

France
18 Posts

Posted - 03/15/2005 :  03:31:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hi Mike,
inelegant or not, it seems to work perfectly well. i would probably never have found the right syntax to write that myself. Thanx a lot.

minor remark: in case of a column graph as with me, the first label appears under the first column if you replace (i-1) in the last but one line with just "i"
thanx again
martin

ps. what is the name for the x-axes title y-offset(that evidently has to be adjusted a bit)?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 03/15/2005 :  09:11:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Martin,

The variable yoff essentially determines how far below the ticks the top of the tick labels will appear. Currently yoff=0.05. To move the labels closer to the ticks make that value smaller. To move the labels further away from the ticks make it larger.

You can position the X axis title (xb) with respect to the tick labels by adding a variable yxb at the top of the script and appending this to the end...

xb.y=L1.y-yxb-(L1.dy/2)-(xb.dy/2);

Adjust yxb to achieve the desired title position.

Mike Buess
Origin WebRing Member
Go to Top of Page

greg

USA
1380 Posts

Posted - 03/18/2005 :  3:13:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
My reply to another post http://www.originlab.com/forum/topic.asp?TOPIC_ID=3809 could be applied here as well.
Given two columns (M and N), you could create a single dataset with the text from each in a multiline format. This does not appear as multiple lines in an Origin worksheet, but will display as such when used as tick labels.

get col(M) -e end;
loop(ii,1,end) {
%A=col(M)[ii]$;
%B=%A;
%A=col(N)[ii]$;
%B=%B
%A;
col(M)[ii]$=%B;
}

When column M is used as the X data, as a Label dataset or as Text from Dataset in Tick Labels, the values will display as multiple lines.


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