Menu

#1736 set link gives strange results with logscale

None
closed-wont-fix
nobody
None
2017-09-04
2016-02-03
Anonymous
No

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.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2016-02-06

    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".

     
    • Ken Olum

      Ken Olum - 2016-02-07

      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.

       
  • Ethan Merritt

    Ethan Merritt - 2016-02-07
    • 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"?

     
    • Ken Olum

      Ken Olum - 2016-02-07

      What is "set axis"? I don't see such a command, at least in 5.0.2.

       
  • Ethan Merritt

    Ethan Merritt - 2016-02-07

    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

          plot FOO using (log($1)):2
    
     
  • Ken Olum

    Ken Olum - 2016-02-08

    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.

     
    • Ethan Merritt

      Ethan Merritt - 2016-02-08

      On Monday, 08 February 2016 01:43:26 AM you wrote:

      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.

      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.

      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.

      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.

      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.


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnuplot/bugs/1736/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • Ethan Merritt

    Ethan Merritt - 2016-03-08
    • summary: set link gives strange results with longscale --> set link gives strange results with logscale
    • status: open --> pending-wont-fix
    • Group: -->
    • Priority: -->
     
  • Ethan Merritt

    Ethan Merritt - 2016-03-08

    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.

     
  • Ethan Merritt

    Ethan Merritt - 2017-09-04
    • Status: pending-wont-fix --> closed-wont-fix
     

Log in to post a comment.