New patch supporting nonlinear axes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

New patch supporting nonlinear axes

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



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: New patch supporting nonlinear axes

Plotter-2
On 01/04/16 04:35, sfeam wrote:

> 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 Ethan,

This non-linear axis mechanism looks very flexible.  I had a case a
while ago where the broken axis format would have been useful. Nice
feature.

Reading these demos points out how many neat features I'm still not
familiar with in the amazing software.

The mix of 2D and 3D plots is very tidy. But it seems you may have
missed out the usual link to the demo code that produced it.

regards, Peter.







------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Logit scale? Was Re: New patch supporting nonlinear axes

Nicolas Brouard INED
In reply to this post by sfeam

> Le 1 avr. 2016 à 05:35, sfeam <[hidden email]> 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: [hidden email]





------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logit scale? Was Re: New patch supporting nonlinear axes

sfeam
On Friday, 01 April, 2016 14:50:12 Nicolas Brouard wrote:

>
> > Le 1 avr. 2016 à 05:35, sfeam <[hidden email]> 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".
[snip]
>
> 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?

I think that would be

   logit(p) = log(p/(1-p))
   logistic(a) = 1. / (1. + exp(-a))

   set nonlinear y via logistic(y) inverse logit(y)

   plot [.001:.999] logit(x) title "should be a straight line"

I don't use either the logit or probit conventions in my own work so I
may have the desired forward/reverse settings backwards.

Can you suggest a nice data-driven demo using logit scale?
Or point me to a published graph that uses it?

If the ascii art from "set term dumb" survives, the output of the above
commands is shown here:

  4 +---+---+----+---+---+---+---+----+---+-----  
  3 +                                      ***+  
  2 +  logit(x) *******                  ***  +  
    |                                  **     |  
    |                                **       |  
  1 +                              **         +  
    |                           ***           |  
    |                         ***             |  
    |                       ***               |  
    |                     ***                 |  
  0 +                   ***                   +  
    |                 ***                     |  
    |               ***                       |  
    |             ***                         |  
    |           ***                           |  
 -1 +         **                              +  
    |       **                                |  
    |     **                                  |  
 -2 +  ***                                    +  
 -3 +***                                      +  
 -4 +---+---+----+---+---+---+---+----+---+-----  
    0  0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9  1  


        Ethan






------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logit scale? Was Re: New patch supporting nonlinear axes

Nicolas Brouard INED
Resent because of the limitation to 150k of the gnuplot-beta mailing list!

Dear Ethan,


I looked back at the data that I used when I was looking for a plotter which could do logistic scale.
It was before the new law on abortion (2001) which made legal the 11th and and 12th week of pregnancy.
But any cumulative distribution could be of interest.
I did not install yet the patch but a possible code could be (notice that “expit" is the standard expression for inverted logistic):
logit(p) = log(p/(1-p))
expit(a) = 1. / (1. + exp(-a))
set nonlinear y via expit(y) inverse logit(y)
plot [.001:.999] "Agegestationnel.txt" u 1:3 w l,"" u 1:4 w l , "" u 1:5 w l, "" u 1:6 w l,  "" u 1:7 w l, "" u 1:8 w l,  "" u 1:9 w l, "" u 1:10 w l,  "" u 1:10 w l,  "" u 1:11 w l,  "" u 1:12 w l,  "" u 1:13 w l
I can test it.

Here is what I got from Excel in year 2000!



> Le 1 avr. 2016 à 19:36, Ethan A Merritt <[hidden email]> a écrit :
>
> On Friday, 01 April, 2016 14:50:12 Nicolas Brouard wrote:
>>
>>> Le 1 avr. 2016 à 05:35, sfeam <[hidden email]> 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".
> [snip]
>>
>> 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?
>
> I think that would be
>
>  logit(p) = log(p/(1-p))
>  logistic(a) = 1. / (1. + exp(-a))
>
>  set nonlinear y via logistic(y) inverse logit(y)
>
>  plot [.001:.999] logit(x) title "should be a straight line"
>
> I don't use either the logit or probit conventions in my own work so I
> may have the desired forward/reverse settings backwards.
>
> Can you suggest a nice data-driven demo using logit scale?
> Or point me to a published graph that uses it?
>
> If the ascii art from "set term dumb" survives, the output of the above
> commands is shown here:
>
> 4 +---+---+----+---+---+---+---+----+---+-----  
> 3 +                                      ***+  
> 2 +  logit(x) *******                  ***  +  
>   |                                  **     |  
>   |                                **       |  
> 1 +                              **         +  
>   |                           ***           |  
>   |                         ***             |  
>   |                       ***               |  
>   |                     ***                 |  
> 0 +                   ***                   +  
>   |                 ***                     |  
>   |               ***                       |  
>   |             ***                         |  
>   |           ***                           |  
> -1 +         **                              +  
>   |       **                                |  
>   |     **                                  |  
> -2 +  ***                                    +  
> -3 +***                                      +  
> -4 +---+---+----+---+---+---+---+----+---+-----  
>   0  0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9  1  
>
>
> Ethan
>
>
>
>
>

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
gnuplot-beta mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Agegestationnel.txt (7K) Download Attachment
Gestational-age3.jpeg (95K) Download Attachment
Loading...