Gnuplot interface
[Multidimensional Dynamic Arrays]

Classes

Files


Detailed Description

Simple interface to call gnuplot and send MArray and FVector objects. An instance of a Gnuplot class encapsulates a pipe into gnuplot's stdin. It exports a stream interface to the user, so that any gnuplot command can be sent via operator<<. For convenience, functions handling the loops over elements and the necessary formatting to plot elements of 1-D MArray against index number, two 1-D MArray against each other, 2-D MArray surfaces, and elements of any stl-iterator compatible container are provided.

The follwing example code should be self-explanatory:

    MArray<float,1> A;

    Gnuplot gp;  // start a gnuplot session and open pipe
    Gnuplot gp ("gnuplot-cmd"); // alternative command string

    // plot elements of A against index number:
    gp << "plot '-' with lines\n";
    gp.send (A);

    MArray<float,1> X, Y;
    // add a plot of Y vs. X to previous plot
    gp << "replot '-' with points\n";
    gp.send (X,Y);

    MArray<float,2> S;
    // a surface plot of 2-D MArray S
    gp << "splot '-' with lines\n";
    gp.send (S);

    std::vector<float> v;
    float *f;
    // plot an iterator range
    gp << "plot '-' with points\n";
    gp.send_iter (v.begin(), v.end());
    gp << "replot '-' with points\n";
    gp.send_iter (f, f+10);

    double mx, my;
    int mb;
    gp.getMouse(mx, my, mb);

Generated on 19 Feb 2015 for LTL by  doxygen 1.6.1