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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Formatting Axis Labels and Adding Second X Axis

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
crickles Posted - 10/28/2016 : 2:39:33 PM
Origin Ver. and Service Release: OriginPro 2016 (64-bit) Sr2 b9.3.2.303 (Student Version)
Operating System: Windows 10

I routinely collect data and plot it in origin. I have been learning labtalk to simplify the plotting process.

I would like my plots to look something like this:


The main part Im having trouble with is seting a second x axis and setting the axis labels.

When I open my raw data, it looks like this:


I then run a simple labtalk script to format the data better:

wks.col = 2 ;
wks.insert();

//Rename Column Identifiers;
wks.col1.name$ = AgCl;
wks.col2.name$ = RHE;
wks.col3.name$ = Amp;

//Set column long name;
col(1)[L]$ = Potential;
col(1)[U]$ = V vs Ag/AgCl;

col(2)[L]$ = Potential;
col(2)[U]$ = V vs RHE;


col(3)[L]$ = Current;
col(3)[U]$ = Amp;

//Set col(b) as X2;
wks.col2.type = 4;

//Set col(b) to RHE ADJUST PH VALUE DEPENDING ON EXPERIMENT;
//RHE  = Ag/AgCl + 0.1997 + 0.059*pH
col(2) = col(1) + 0.1997 + 0.059*4;

//Add Column for mAmp;
wks.addCol(mAmp);

//set mAmp settings;
col(mAmp)[L]$ = Current;
col(mAmp)[U]$ = mAmp;

col(mAmp) = col(Amp) * 1000;


I want the y axis to have the same label as shown in my first picture. If I edit it directly on the worksheet, I would use the alt code ALT+249 to make the dot operator (∙). however Alt codes do not work in the labtalk scrip editor.

So when I use the first part of my script, my worksheet looks like this:


This is almost what I want except that the Y2 column does not quite have the units that I need


My first question is how do I add italics for the axis labels and how would I use the dot operator so that I can write (j / mAmp ∙ cm^-2) as shown in the first picture.


I then plot this using the second half of my script which is:

//Plotting Data
plotxy iy:=(2,4) plot:=200;


//FIXING PLOT DETAILS;
//Increase axis thickness;
layer.x.thickness = 1.5;


//Make Box Around Figure;
layer.x.opposite = 1;
layer.y.opposite = 1;

//Set Major Tick Length
layer.tickL = 12;


//Set Font Size of Tick Labels
layer.x.label.pt = 24;
layer.y.label.pt = 24;

//Set Font Size of Axis Labels
xb.fsize = 28;
yl.fsize = 28;

//Moving Legend
legend.x=layer.x.to - legend.dx/2;
legend.y=layer.y.to - legend.dy/2;

//Set Linewidth to 1.5 (I dont understand why 750 gives 1.5 but it does);
set %C -w 750;


This gives me the following plot:


My second question is, How do I set the X1 Column (AgCl) as the second x axis at the top of the plot and how do I add an axis label to this second axis?
1   L A T E S T    R E P L I E S    (Newest First)
yuki_wu Posted - 11/01/2016 : 01:54:00 AM
Hi,
I am not sure whether the answers is what you want, especially to question 1. Please take a look at the following answer and see if this applies to you.

To question 1:
You can format text as italics by \i(text). For example, add a new label in the active window.
label \i(test);

About the dot operator, you can just type as usual:
label te•st;

If you want to know more about the Label object, you can go to this page:
http://www.originlab.com/doc/LabTalk/ref/Label-cmd

To question 2:
You should add a new layer with axis by:
layadd type:=txry;

And then specifies a column dataset to control the tick labels:
layer.x.labeltext$=book1_A;

More information about the axis object can be found here:
http://www.originlab.com/doc/LabTalk/ref/Layer-Axis-obj

If this is not what you want, please post your question more straightforward.

Thanks,
Yuki
OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000