Can someone elaborate in more detail on the set nonlinear
and set link
functions. The documentation is too brief on those topics. Specifically, for set link
, why is in necessary to spell out the inverse tranformation? (is it just because gnuplot does not have the capability to determine the inverse tranformation or is there any deeper reason?) What if as inverse I do provide a completely different function (not being an inverse)?
e.g. I would assume that in the following example, at least one plot would be a line but it is not, in order to produce a line, one needs to plot the third command
set xrange [0:5]
set link x2 via x**2 inverse sqrt(x)
plot x**2 axes x2y1
plot x**2 axes x1y1
plot sqrt(x) axes x2y1
This brings me back to the question, what is the purpose of the inverse in the link specification.
Now back to set nonlinear
, the documentation states: "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." I do not understand what the hidden axis is supposed to be and what is the linear axis. The example set nonlinear x via log10(x) inverse 10**x
makes sense to me but not in the context of the terms used in documentation (I understand the transformation but I have no idea what role the hidden axis plays here, also, there is no need for the inverse in such a transformation).
The most interesting example is the one with broken axis:
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
But I do not understand it at all (I understand the function definition but not in the context of the nonlinear
feature). It might be probably most useful to explain the set nonlinear
and the hidden axes nomenclature on this example.
Reaction to the answer:
Let's say first I want to plot a function f(x)
. Let v(x)
be a mapping from the linear to the visible axis: v:L->V
and l(x)
be the inverse, that is l:V->L
(L
should probably correspond to xrange
in gnuplot). From the answer I did not understand how f(x)
is calculated. If f(x): X->R
(that is a mapping from some subset of Real numbers to real numbers), where does the X
come from under those mappings. Normally (no linking or nonlinear axes) (and it holds that L=V
and v
and l
are identity maps) the Y
axis would contain numbers {y=f(x)
, such that x
is in V
}.
This becomes a little confusing in the nonlinear case, in other words do the x
come form the L
or V
space, or are the x
in y = f(x)
from the set of numbers of already tranformed X
axis which would really be f(v(x))
where x
are taken from the xrange
set in gnuplot (or space L
), or is it really f(x)
, where x
is from L
or is it f(l(x))
where x
are taken again from transformed X
axis which really is again f(l(v(x)))
x
being from the L
space or xrange
? Also, this would be a difference from the set link
which really cannot have any effect on how f(x)
is calculated.
(Interestingly enough, when plotting data the situation would probably need to be more similar to set link
since there is no function to transform.)