14.10.2014 Views

gnuplot documentation

gnuplot documentation

gnuplot documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

194 <strong>gnuplot</strong> 4.3 77 TERMINAL<br />

% source plot.file<br />

% canvas .c<br />

% pack .c<br />

% <strong>gnuplot</strong> .c<br />

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

use Tk;<br />

my $top = MainWindow->new;<br />

my $c = $top->Canvas->pack;<br />

my $<strong>gnuplot</strong> = do "plot.pl";<br />

$<strong>gnuplot</strong>->($c);<br />

MainLoop;<br />

The code generated by <strong>gnuplot</strong> creates a procedure called "<strong>gnuplot</strong>" that takes the name of a canvas as<br />

its argument. When the procedure is called, it clears the canvas, finds the size of the canvas and draws<br />

the plot in it, scaled to fit.<br />

For 2-dimensional plotting (plot) two additional procedures are defined: "<strong>gnuplot</strong> plotarea" will return<br />

a list containing the borders of the plotting area "xleft, xright, ytop, ybot" in canvas screen coordinates,<br />

while the ranges of the two axes "x1min, x1max, y1min, y1max, x2min, x2max, y2min, y2max" in<br />

plot coordinates can be obtained calling "<strong>gnuplot</strong> axisranges". If the "interactive" option is specified,<br />

mouse clicking on a line segment will print the coordinates of its midpoint to stdout. Advanced actions<br />

can happen instead if the user supplies a procedure named "user <strong>gnuplot</strong> coordinates", which takes the<br />

following arguments: "win id x1s y1s x2s y2s x1e y1e x2e y2e x1m y1m x2m y2m", the name of the<br />

canvas and the id of the line segment followed by the coordinates of its start and end point in the two<br />

possible axis ranges; the coordinates of the midpoint are only filled for logarithmic axes.<br />

The current version of tkcanvas supports neither multiplot nor replot.<br />

77.67 Tpic<br />

The tpic terminal driver supports the LaTeX picture environment with tpic \specials. It is an alternative<br />

to the latex and eepic terminal drivers. Options are the point size, line width, and dot-dash interval.<br />

Syntax:<br />

set terminal tpic <br />

where pointsize and linewidth are integers in milli-inches and interval is a float in inches. If a<br />

non-positive value is specified, the default is chosen: pointsize = 40, linewidth = 6, interval = 0.1.<br />

All drivers for LaTeX offer a special way of controlling text positioning: If any text string begins with<br />

’{’, you also need to include a ’}’ at the end of the text, and the whole text will be centered both<br />

horizontally and vertically by LaTeX. — If the text string begins with ’[’, you need to continue it with:<br />

a position specification (up to two out of t,b,l,r), ’]{’, the text itself, and finally, ’}’. The text itself may<br />

be anything LaTeX can typeset as an LR-box. \rule{}{}’s may help for best positioning.<br />

Examples: About label positioning: Use <strong>gnuplot</strong> defaults (mostly sensible, but sometimes not really<br />

best):<br />

set title ’\LaTeX\ -- $ \gamma $’<br />

Force centering both horizontally and vertically:<br />

set label ’{\LaTeX\ -- $ \gamma $}’ at 0,0<br />

Specify own positioning (top here):<br />

set xlabel ’[t]{\LaTeX\ -- $ \gamma $}’<br />

The other label – account for long ticlabels:<br />

set ylabel ’[r]{\LaTeX\ -- $ \gamma $\rule{7mm}{0pt}}’

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!