plot [<range specifier> ...] ('<filename>'|<function>) [using <using specifier>] [axes <axis specifier>] [select <select specifier>] [index <index specifier>] [every <every specifier>] [with <style> [<style modifier> ... ] ]
The plot command is the main workhorse command of PyXPlot, which is used to produce all plots. For example to plot the sine function:
plot sin(x)
Ranges for the axes of a graph can be specified by placing them in square-brackets before the name of the function to be plotted. Leaving a set of brackets empty specifies that an axis will be automatically scaled, as happens by default. An example of this syntax would be:
plot [-pi:pi] sin(x)
which would plot the function across some default range of values on the
-axis.
Datafiles may also be plotted as well as functions, in which case the filename of the datafile to be plotted should be enclosing in apostrophes. An example of this syntax would be:
plot 'datafile' with points
which would plot the file called ‘datafile’. Section 2.5 should be studied for further details of the format that is expected of input datafiles, and how PyXPlot may be directed to plot only certain portions of datafiles.
In plots which have multiple parallel axes – for example, an -axis along its lower edge and an
-axis along its upper edge – the pair of axes against which data should be plotted should be specified using the modifier axes following the name of the function or datafile to be plotted, for example:
plot sin(x) axes x2y1
The style in which data should be plotted may be specified following the modifier with, with the following syntax:
plot sin(x) with points
The following plot styles are recognised: lines, points, linespoints, dots, boxes, wboxes, impulses, steps, histeps, fsteps, xerrorbars, yerrorbars, xyerrorbars, xerrorrange, yerrorrange, xyerrorrange,
arrows_head, arrows_nohead, arrows_twohead, csplines, acsplines.
In addition, lp and pl are recognised as abbreviations for linespoints; errorbars is recognised as an abbreviation for yerrorbars; errorrange is recognised as an abbreviation for yerrorrange; and arrows_twoway is recognised as an alternative for arrows_twohead.
As well as plot styles, the with modifier can also be followed by the following keywords:
– specifies the linetype (e.g. dotted) used by the lines plot style.
– specifies the width of line, in pt, used by the lines plot style.
– specifies the size of datapoints, relative to the default size, used by the points plot style.
– as above, but specifies the linewidth, in pt, used to render the crosses, circles, etc, used to mark datapoints.
– this can be used in conjunction with the set linestyle command to save default plot styles.
– specifies the colour used to plot the dataset, either by one of the recognised colour names or by an integer, to use one from the current palette.
– relavant to the boxes and wboxes plot styles, specifies a colour in which bar charts should be filled.
An example using several of these keywords would be:
plot sin(x) axes x2y1 with colour blue linetype 2 \ linewidth 5
Multiple datasets can be plotted on a single graph by listing them with commas separating them:
plot sin(x) with colour blue, cos(x) with linetype 2