Contents Previous Next Subchapters

Autoscaling Multiple Plots To Same Axis Limits
Syntax axiscale(data)
See Also gxaxis(type)

Description
Determine good linear axis scaling parameters for data that is in one or more plots. The integer, real, or double-precision matrix data contains all of data that needs to be included in the plotting limits. The return value is a double-precision column vector. Its first element is the minimum value for the axis. Its second element is the maximum value. Its third element is number of major divisions and the fourth is the number of minor divisions.

Example
The following program plots both the exponential function and a sine wave in separate viewports with the same y-axis scaling.

clear
x     = 0. : .01 : 1. 
y1    = sin(2 * pi * x)
y2    = exp(x)
scale = axiscale([y1, y2])
#
gaddview(0., 0., .5, 1.);
gyaxis("linear", scale(1), scale(2), int(scale(3)), int(scale(4)))
gplot(x, y1) 
#
gaddview(.5, 0., .5, 1.);
gyaxis("linear", scale(1), scale(2), int(scale(3)), int(scale(4)))
gplot(x, y2)