#591 Link primary and secondary axes


This patch is a re-working of ideas and preliminary patches that have been floated before. This time around I think it is looking pretty solid. It adds a new command:

link {xaxes|yaxes} {via <expression1> inverse <expression2>}

The simple case "link x" locks the x2 axis range and scale to that of x. This provides a simple answer to the FAQ about how to stop the x and x2 axes from getting out of register if both are used in the same plot.

The more complex case allows you to provide an arbitrary mapping function that relates coordinates on the x axis to those on the x2 axis. For example, "link xaxes via log(x) inverse exp(x)" has roughly the same effect as "set log x2", except that the axis range is tied to the axis range of x. The link command allows other non-linear mappings as well, for example "link x via 1/x inverse 1/x" or "link y via sqrt(y) inverse y**2". I think this can be used to create Weibull plots or other probability distribution tests; it would be nice to add that as a demo.

Mouse readout of non-linear mappings works correctly in the core code. Unfortunately, I do not see how to make this work automatically in svg or html output. The closest I can think of is to write out the forward and reverse mappings in gnuplot syntax as comments in the javascript output that is produced. The user would then have to translate these comments into actual javascript manually.


  • Petr Mikulik

    Petr Mikulik - 2012-07-25

    It's great!
    I propose syntax "set link ..." instead of a new command "link".

  • Ethan Merritt

    Ethan Merritt - 2012-08-06

    Now in CVS

  • Ethan Merritt

    Ethan Merritt - 2012-08-06
    • status: open --> closed-accepted
  • Ethan Merritt

    Ethan Merritt - 2012-08-06

    Link x:x2 or y:y2 axes via an arbitrary coordinate mapping


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks