By default, plots have only one
-axis and one
-axis. Further parallel
axes can be added and configured via statements such as:
set x3label 'foo' plot sin(x) axes x3y1 set axis x3
In the top statement, a further
axis, called
is implicitly
created by giving it a label. In the next, the axes modifier is used
to tell the plot command to plot data against the
-axis, which
also implicitly created such an axis if it doesn't already exist. In the third,
an
-axis is explicitly created.
Unlike gnuplot, which allowed only a maximum of two parallel axes to be added
to plots, PyXPlot allows an unlimited number of axes to be used. Odd-numbered
-axes appear below the plot, and even numbered
-axes above it; a similar
rule applies for
-axes, to the left and to the right.
As discussed in the previous chapter, the ranges of axes can be set either
using the set xrange command, or within the plot command. The following two
statements would set an equivalent range for the
-axis:
set x3range [-2:2] plot [:][:][:][:][-2:2] sin(x) axes x3y1
As usual, the first two ranges specified in the plot command
apply to the
- and
-axes. The next pair apply to the
- and
-axes,
and so forth.
Having made axes with the above commands, they may subsequently be removed using the unset axis command as follows:
unset axis x3 unset axis x3x5y3 y7
The top statement, for example, would remove axis
. The command
unset axis on its own, with no axes specified, returns all axes to
their default configuration. The special case of unset axis x1 does
not remove the first
-axis - it cannot be removed - but instead returns it
to its default configuration.
It should be noted, that if the following two commands are typed in succession, the second may not entirely negate the first:
set x3label 'foo' unset x3label 'foo'
The first may have implicitly created an
-axis, which would need
to be removed with the unset axis x3 command.
A subtly different task is that of removing labels from axes, or setting axes not to display. To achieve this, a number of special axis labels are used. Labelling an axis ``nolabels'' has the effect that no title or numerical labels are placed upon it. Labelling it``nolabelstics'' is stronger still; this removes all tick marks from it as well (similar in effect to set noxtics in gnuplot). Finally, labelling it ``invisible'' makes an axis completely invisible.
Labels may be placed on such axes, by following the magic keywords above with a colon and the desired title, for example:
set xlabel 'nolabels:Time'
would produce an
-axis with no numeric labels, but a label of
`Time'.
Several examples of effects which can be achieved with these commands can be found in Example 10 (see section 5.10). In the unlikely event of wanting to label a normal axis with one of these magic words, this may be achieved by prefixing the magic word with a space. There is one further magic axis label, linkaxis, which will be described in section 3.5.
The ticks of axes can be configured to point either inward, towards the plot, as is the default, or outward towards the axis labels, or in both directions. This is achieved using the set xticdir command, for example:
set xticdir inward set y2ticdir outward set x2ticdir both
Dominic Ford 2006-09-09