A library which allows the user to
typeset several plots in a matrix like structure. Often one has
to compare two plots to one another, or you simply need to
display two plots in conjunction with each other. Either way the
following section describes this library which makes matrix
structure easier than alternative methods discussed in
Section 4.19.4.
Once you have loaded the
groupplots
library you will gain access to this environment. This
environment is limited to the same restrictions as the
axis
environment. It actually utilizes this environment so consider
it as an extension of this. What is important to note is that
[options] are applied to all plots in the entire environment. This can
be really handy when you need the same
xmin,
xmax,
ymin
and
ymax.
With such an environment one can typeset plots in matrix like styles
The equivalent code is seen as the second example and it is clear
that you have to type a lot less. So how do you use it? First of all
you need to utilize the new environment
groupplot. Within this environment the following command works.
\nextgroupplot[axis options]
normal plot commands¶
This command shifts the
placement of the plot. Therefore one should always start the
environment
groupplot
with the command
\nextgroupplot
in order to create the first plot. The [axis options] are the options that are supplied to the following axes until
the next
\nextgroupplot
command is seen by
TeX. The order in which figures are typeset are as seen in the
next example.
The plot first fills the first row, then the next row and so on.
Just like a table, thus the names group ccolumnrrow. The power of the
groupplot
is to quickly create an aligned structure of plots. But you can
also utilize it to structure data more creatively. Consider the
next example.
Or for instance zooming in on data as in the next example.
These keys determine the total number
of plots that can be in one environment
groupplot. It is thus important not to add more
\nextgroupplot
in the environment than
columns\(\times \)rows. This is critical to set if one uses more than 1 more plot. As
the key
group size
uses
columns
and
rows
you should stick to either
group size
or both
columns
and
rows.
The spacing
between the plots in the horizontal and vertical direction,
respectively. If you thus want them to be glued together
you should set them both to a length of 0pt.
In order to
determine which plots get labels typeset one can use these keys.
By default all axes get typeset normally and thus have both
\(x\)- and \(y\)-axis labels.
In the example above, only the bottom row gets the label defined
in the beginning
groupplot
environment on the \(x\)-axis and only the first column of plots
gets labels on the \(y\)-axis on their left side. These keys are
especially handy when using glued plots.
In order to
determine which plots get tick labels typeset one can use these
keys. By default all axes gets typeset normally and thus have
both \(x\)- and \(y\)-axis tick labels. If one sets
only the bottom row gets tick labels on the \(x\)-axis and only
the last column gets tick labels on the \(y\)-axis on their
right side. These keys are specially handy when using
glued plots.
Keep in mind that this is implies the same ticks for all plots.
This key can
be used as an option to the command
\nextgroupplot. This makes the next plot invisible (only the axes) but
maintains it anchors and name. If you want it to behave in
another style then you can redefine it. Consider the same
example as before.
Notice that you need to call a
\nextgroupplot
again to jump to the next plot.