#321 Pseudofile '+' allows a `using` spec for functions

closed-accepted
Ethan Merritt
None
5
2007-03-24
2007-01-29
Ethan Merritt
No

Currently function plots are limited to using plot styles requiring only a single value per sampled point. Unlike data plots, you cannot specify additional columns of data in a `using` specifier.

This patch creates a pseudo-filename '+' that allows function plots to use the `using` mechanism to handle additional values at each sample point. This allows the full range of plot styles (filledcurves, labels, errorbars, vectors, ...) to be used with analytic functions.

For example:
f(x) = sin(x)
g(x) = sin(x)**2
plot '+' using 1:(f($1)):(g($1)) with filledcurves

See
help datafile special-filenames
new demo "approximations.dem" (output attached)

The implementation is straightforward for normal 2D plots, slightly non-obvious for normal 3D plots (but no worse than writing to a file and reading the file back in, as in the vectors demo). However, I am a relative novice at using parametric functions, so these are essentially untested.

Discussion

  • Ethan Merritt
    Ethan Merritt
    2007-01-29

    Pseudo-filename '+' allows using specs in function plots

     
  • Ethan Merritt
    Ethan Merritt
    2007-01-29

    Logged In: YES
    user_id=235620
    Originator: YES

    File Added: approximations.png

     
  • Ethan Merritt
    Ethan Merritt
    2007-01-29

    Output of new demo

     
    Attachments
  • Guido De Rosa
    Guido De Rosa
    2007-02-17

    Logged In: YES
    user_id=1320192
    Originator: NO

    Great patch! Useful for bi-dimensional quantum systems... I can plot a function (for example square modulus of a wave function) and take the colors for pm3d by anther function (the phase)... Generally that could be an expressive way to plot complex-valued functions...

    Here's an example of such a 3D plot:

    set pm3d at s explicit
    f(x,y)=exp(-2*x*x-y*y
    g(x,y)=sin(x*y*2.5))
    splot [x=-2:2][y=-2:2] '+' using 1:2:(f($1,$2)) :(g($1,$2)) w pm3d

    Here's my demo just rendered!
    http://bp2.blogger.com/_PmiNKI2aCpI/RdZ1xbwVarI/AAAAAAAAAA4/APpFrXWgoH4/s1600-h/extpm3d.png
    http://www.studenti.unina.it/~gcderosa/simula/extpm3d.png

    ps.: it might be useful a "native support", i.e. something less tricky, with a syntax like:
    splot f(x,y) w pm3d=g(x,y)

     
  • Ethan Merritt
    Ethan Merritt
    2007-02-28

    Update for current cvs; add 2nd demo

     
  • Ethan Merritt
    Ethan Merritt
    2007-02-28

    Logged In: YES
    user_id=235620
    Originator: YES

    File Added: pseudodata_27feb2007.patch

     
  • Ethan Merritt
    Ethan Merritt
    2007-03-09

    • status: open --> pending-accepted
     
  • Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending-accepted --> closed-accepted