14.10.2014 Views

gnuplot documentation

gnuplot documentation

gnuplot documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

60 PLOT <strong>gnuplot</strong> 4.3 79<br />

Example:<br />

file(n) = sprintf("dataset_%d.dat",n)<br />

plot for [i=1:10] file(i) title sprintf("dataset %d",i)<br />

This example defines a string-valued function that generates file names, and plots ten such files together.<br />

The iteration variable (’i’ in this example) is treated as an integer, and may be used more than once. In<br />

this example it is used both to generate a file name and a corresponding title.<br />

Example:<br />

list = "a b c foo baz"<br />

item(n) = word(list,n)<br />

plot for [i=1:words(list)] item[i].".dat" title item(i)<br />

list = "new stuff"<br />

replot<br />

This example steps through a list and plots once per item. Because the items are retrieved dynamically,<br />

you can change the list and then replot.<br />

60.8 Title<br />

A line title for each function and data set appears in the key, accompanied by a sample of the line and/or<br />

symbol used to represent it. It can be changed by using the title option.<br />

Syntax:<br />

title "" | notitle [""]<br />

where is the new title of the line and must be enclosed in quotes. The quotes will not be shown<br />

in the key. A special character may be given as a backslash followed by its octal value ("\345"). The tab<br />

character "\t" is understood. Note that backslash processing occurs only for strings enclosed in double<br />

quotes — use single quotes to prevent such processing. The newline character "\n" is not processed in<br />

key entries in either type of string.<br />

The line title and sample can be omitted from the key by using the keyword notitle. A null title (title<br />

’ ’) is equivalent to notitle. If only the sample is wanted, use one or more blanks (title ’ ’). If notitle<br />

is followed by a string this string is ignored.<br />

If key autotitles is set (which is the default) and neither title nor notitle are specified the line title is<br />

the function name or the file name as it appears on the plot command. If it is a file name, any datafile<br />

modifiers specified will be included in the default title.<br />

The layout of the key itself (position, title justification, etc.) can be controlled by set key. Please see<br />

set key (p. 106) for details.<br />

Examples:<br />

This plots y=x with the title ’x’:<br />

plot x<br />

This plots x squared with title "x^2" and file "data.1" with title "measured data":<br />

plot x**2 title "x^2", ’data.1’ t "measured data"<br />

This puts an untitled circular border around a polar graph:<br />

set polar; plot my_function(t), 1 notitle<br />

60.9 With<br />

Functions and data may be displayed in one of a large number of styles. The with keyword provides<br />

the means of selection.<br />

Syntax:

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

Saved successfully!

Ooh no, something went wrong!