If the given axis is logarithmic, should set link specify the mapping of the variable or its logarithm?
In 5.0.2 on Ubuntu 12.04 LTS, I did this:
set xtics nomirror
set logscale y
set link y2 via 2*y inverse y/2
set y2tics
plot [0.1:1] x
The tic labels on the y2 axis go from 0.01 to 1, as though the transformation is to double log y and so square y. But the list of coordinates at the bottom of the window shows y2 as twice y.
Sort of a tangential answer to your question -
The original intent of 'set link' was to generalize and replace 'set log'. Little if any thought was given to what would happen if you tried to use both at the same time.
So I think the real answer is "Don't do that".
I'm the original poster. Sorry about not logging in first and the typo in the title.
I don't see how set link could replace set logscale. Set link sets the second axis by reference to the first -- set logscale changes the first axis. In any case, what I'm really trying to do is to show a spectrum with frequency on the bottom and period on the top. I'm sure things like this are a common need.
The idea was to create a linear dummy/virtual axis and then use "link" to map it onto a logscale visible axis. That much does work, but it isn't sufficient to replace the current logscale code because of all the special-case handling of axis tics and ranges.
frequency/period: sure, I do that all the time. See for example the demo
http://gnuplot.sourceforge.net/demo_canvas_5.1/linkedaxes.html
I've never had occasion to mix in logscale, but can't you add the log/exp operation to the "set axis" command rather than using "set logscale"?
What is "set axis"? I don't see such a command, at least in 5.0.2.
Oops. Sorry, I meant "set link". But never mind, my previous suggestion makes no sense.
Let's take a step back.
Exactly what is it that you want on your x1 and x2 axes? Both log-scale?
Can you just say
On the x1 axis I want several decades of angular frequency omega plotted on a logarithmic axis with major ticks at powers of 10 and labeled with the frequency (10, 100, 1000, ...) not its logarithm. On the x2 axis I want period = 2 pi / omega, also logarithmic, labeled by the period. I think this is what should be accomplished by
set link x2 via 2pi/x inverse 2pi/x
Instead it is accomplished by
set link x2 via log10(2pi)-x inverse log10(2pi)-x
which I found rather odd, but would not be problematic at least if documented. But then I have the problem that when I move the mouse over the line and try to see the period of the feature I'm pointing at, it displays instead the logarithm of the period.
The problem with "using (log($1))" is that then the axes are labeled by the logarithm instead of the frequency or period.
On Monday, 08 February 2016 01:43:26 AM you wrote:
I'll have a look at the code. I really think the combination of "set link" and "set log"
was never considered and therefore never tested.
That by itself needn't be a problem if you set the tic marks manually.
I agree that is annoying, which is why I said "set link" cannot quite replace
"set logscale" in its current state.
After looking into the code, I don't think remapping log scaledlinked axes is feasible. I've added a warning if the user tries to do so. But this has prodded me to get back to generalizing the linked axis code so that it may by itself be used for log-scaling.