|
From: Nicolas B. <br...@in...> - 2016-04-01 12:50:20
|
> Le 1 avr. 2016 à 05:35, sfeam <sf...@us...> a écrit : > > I have placed a patchset on SourceForge that introduces a general mechanism > for defining nonlinear axes in a plot. > > https://sourceforge.net/p/gnuplot/patches/728/ > > Demos here: > > http://skuld.bmsc.washington.edu/~merritt/gnuplot/#nonlinear > > It uses the linked-axis mechanism of forward and reverse mappings introduced > in the "set link {axis} via f(x) inverse g(x)" command with the major > difference that it links a non-linear visible axis with a hidden axis that is > always linear. > > One motivation is to eventually replace the current implementation of > logscale axes with something that is both more general and less expensive. > The effect of the existing command > set logscale x > can be achieved by the new command > set nonlinear x via log10(x) inverse 10**x > > A major advantage over the existing logscale implementation is that > coordinates are not transformed on input. The current logscale > code stores the log of the true coordinate, which then requires that > every single reference to that coordinate throughout the core gnuplot > code is mediated by macros AXIS_DO_LOG, AXIS_UNDO_LOG, AXIS_LOG_VALUE, > etc. Every time the coordinate is needed we check whether it was > stored as the log, unlog it if so, do whatever it was we wanted, > then reapply the log for comparison with other stored values. > By contrast the new nonlinear axis code simply stores the original > coordinate value. The nonlinear mapping (log in this case) is only > needed when we map it to a position on the output terminal canvas. > > The log()/exp() transform is an example of a nonlinear axis mapping, > but the new code is happy to accept other transforms as well. > This defines a probability plot axis: > set nonlinear x via norm(x) inverse invnorm(x) > See demo "probably_tux.dem". > > Another non-obvious example is creation of a "broken axis" plot. > This is a recurring feature request. In this case the hidden linear > axis spanning the full range [min:max] is mapped onto a visible axis > that shows only the first part and the last part of the range (see demo). > > Notes: > > The "set nonlinear x" command itself is sufficient to create a > log-scaled x axis. For backwards compatibility with the existing > behaviour, there is a second command "set xtics log" that reuses the > old tic-placement code. > > This version of the patch set only reserves space for hidden axes > shadowing the x and y axes. Extending it to handle the other visible > axes (x2 y2 z cb) should be trivial. > > The pieces are already in place to construct log-scaled or broken > axis plots, as shown by the demos. Once any bugs are shaken out, > I envision wrapping these in simple commands for easier use. > > For example, the command "set log" will continue to do what is has > always done but will use the new code rather than all those > LOG/DE_LOG macros underneath. > > The manual definition of mappings and axis markings for a broken axis > can be automated by introducing some new command analogous to the way > "set multiplot layout ..." automates manipulation of the scale and > offset parameters. > > Hi, I haven’t looked at the patch yet but my dream was to have a logit scale implemented in Gnuplot. Some years (decade?) ago, I gave up because of the y-axis notation which of course should be implemented as for the log scale (.001 0.01 0.99 .999 etc). Would your patch do this? Nicolas -- Nicolas Brouard Institut national d'études démographiques 133 Boulevard Davout 75020 Paris mél: br...@in... |