4.25 FAQ-384 How does Origin come up with appropriate Tick Labels for my data?

Last Update: 11/3/2015

The problems of setting correct axis scales and calculating reasonable tick labels are handled by the limit command in LabTalk. For example:

newbook;
range rax = 1!col(a);
rax = data(17.3,23.6,.25);
range ray = 1!col(b);
ray = normal(rax.GetSize());

// calculate statistics descriptive values for X and Y datasets
stats rax;  
size = stats.n;
Xbegin = stats.min;
Xend = stats.max;
stats ray;  
Ybegin = stats.min;
Yend = stats.max;
 
// calculate the appropriate increment value and adjust begin and end values
ticks = 5;
ty Beginning with From : $(Xbegin), To : $(Xend), Steps : $(ticks);
limit -r Xbegin Xend ticks increment;
ty Limit command creates From : $(Xbegin), To : $(Xend), Increment : $(increment);

plotxy (1,2);

Then the begin, end and increment values can be used to set the From, To and Increment of an axis respectively.


All standard Origin plot templates also include a margin of 8% that gets added to the range of X and Y data before the application of the above calculation. This property can be modified with

layer.x.rescalemargin
or
layer.y.rescalemargin



Keywords:range, automatic scaling, axis, axes,