manpagez: man pages & more
info gnuplot
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1.0.60 tkcanvas

This terminal driver generates Tk canvas widget commands based on Tcl/Tk (default) or Perl. To use it, rebuild ‘gnuplot‘ (after uncommenting or inserting the appropriate line in "term.h"), then

 gnuplot> set term tkcanvas {perltk} {interactive}
 gnuplot> set output 'plot.file'

After invoking "wish", execute the following sequence of Tcl/Tk commands:

 % source plot.file
 % canvas .c
 % pack .c
 % gnuplot .c

Or, for Perl/Tk use a program like this:

 use Tk;
 my $top = MainWindow->new;
 my $c = $top->Canvas->pack;
 my $gnuplot = do "plot.pl";
 $gnuplot->($c);
 MainLoop;

The code generated by ‘gnuplot‘ creates a procedure called "gnuplot" that takes the name of a canvas as its argument. When the procedure is called, it clears the canvas, finds the size of the canvas and draws the plot in it, scaled to fit.

For 2-dimensional plotting (‘plot‘) two additional procedures are defined: "gnuplot_plotarea" will return a list containing the borders of the plotting area "xleft, xright, ytop, ybot" in canvas screen coordinates, while the ranges of the two axes "x1min, x1max, y1min, y1max, x2min, x2max, y2min, y2max" in plot coordinates can be obtained calling "gnuplot_axisranges". If the "interactive" option is specified, mouse clicking on a line segment will print the coordinates of its midpoint to stdout. Advanced actions can happen instead if the user supplies a procedure named "user_gnuplot_coordinates", which takes the following arguments: "win id x1s y1s x2s y2s x1e y1e x2e y2e x1m y1m x2m y2m", the name of the canvas and the id of the line segment followed by the coordinates of its start and end point in the two possible axis ranges; the coordinates of the midpoint are only filled for logarithmic axes.

The current version of ‘tkcanvas‘ supports neither multiplot nor replot."


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 4, 2012 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.