Credits | Overview | Plotting Styles | Commands | Terminals |
---|
Syntax:
set nonlinear <axis> via f(axis) inverse g(axis) unset nonlinear <axis>
This command is similar to the set link command except that only one of the two linked axes is visible. The hidden axis remains linear. Coordinates along the visible axis are mapped by applying g(x) to hidden axis coordinates. f(x) maps the visible axis coordinates back onto the hidden linear axis. You must provide both the forward and inverse expressions.
To illustrate how this works, consider the case of a log-scale x2 axis.
set x2ange [1:1000] set nonlinear x2 via log10(x) inverse 10**x
This achieves the same effect as set log x2. The hidden axis in this case has range [0:3], obtained by calculating [log10(xmin):log10(xmax)].
The transformation functions f() and g() must be defined using a dummy variable appropriate to the nonlinear axis:
axis: x x2 dummy variable x axis: y y2 dummy variable y axis: z cb dummy variable z axis: r dummy variable r
Example:
set xrange [-3:3] set nonlinear x via norm(x) inverse invnorm(x)
This example establishes a probability-scaled ("probit") x axis, such that plotting the cumulative normal function Phi(x) produces a straight line plot against a linear y axis.
Example:
logit(p) = log(p/(1-p)) logistic(a) = 1. / (1. + exp(-a)) set xrange [.001 : .999] set nonlinear y via logit(y) inverse logistic(y) plot logit(x)
This example establishes a logit-scaled y axis such that plotting logit(x) on a linear x axis produces a straight line plot.
Example:
f(x) = (x <= 100) ? x : (x < 500) ? NaN : x-390 g(x) = (x <= 100) ? x : x+390 set xrange [0:1000] noextend set nonlinear x via f(x) inverse g(x) set xtics add (100,500) plot sample [x=1:100] x, [x=500:1000] x
This example creates a "broken axis". X coordinates 0-100 are at the left, X coordinates 500-1000 are at the right, there is a small gap (10 units) between them. So long as no data points with (100 < x < 500) are plotted, this works as expected.