diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex | 118 |
1 files changed, 104 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex index 056f80c7334..ed18c1a5ffe 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex @@ -1,15 +1,18 @@ \subsection{Grouping plots} +{ \label{sec:group:plot} {\noindent {\emph{by Nick Papior Andersen}}} \index{Group library!Subplots}% +\pgfkeys{/pdflinks/search key prefixes in/.add={/pgfplots/group/,}{}} + \begin{pgfplotslibrary}{groupplots} 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 this typesetting easy. + section describes this library which makes matrix structure easier than alternative methods discussed in Section~\ref{sec:pgfplots:arrayform}. \end{pgfplotslibrary} \begin{environment}{{groupplot}\oarg{options}} @@ -53,11 +56,11 @@ 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. -\begin{command}{\nextgroupplot\oarg{options} \meta{normal plot commands}} +\begin{command}{\nextgroupplot\oarg{axis options} \meta{normal plot commands}} \label{cmd:pgfplots:nextgroupplot} This command shifts the placement of the plot. Therefore one should always start the environment |groupplot| with the command -\textbackslash|nextgroupplot| in order to create the first plot. The \oarg{options} are the options that are supplied to the following plot commands until -the next \textbackslash|nextgroupplot| command is seen by \TeX. +|\nextgroupplot| in order to create the first plot. The \oarg{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. % \usepgfplotslibrary{groupplots} \begin{codeexample}[] @@ -131,17 +134,19 @@ Or for instance zooming in on data as in the next example. \subsubsection{Grouping options} \label{sec:pgfplots:group:options} -Here the various available options of the library resides. +Here the various available options of the library reside. + +\begin{pgfplotskey}{group style=\marg{options with {\normalfont\texttt{group/}} prefix}} + This key sets all \meta{options} using the |/pgfplots/group/| prefix. + + Note that the distinction between |group/| and normal options is important has some of them are quite similar. -\begin{pgfplotskey}{group style=group/.cd,\marg{options}} - This key allows one to faster reach the group options. Some of the options are very similar to the normal commands so they are supplied in another - subdirectory |group|. So the following are equivalent. + For example, the following statements are all equivalent: \begin{codeexample}[code only] \pgfplotsset{group style={a=2,b=3}} \pgfplotsset{group/a=2,group/b=3} \pgfplotsset{group/.cd,a=2,b=3} \end{codeexample} -It can thus decrease the size of your options with out destroying the clearness of where options belong. \end{pgfplotskey} All the following keys are in the subdirectory |group|. @@ -149,7 +154,7 @@ All the following keys are in the subdirectory |group|. group/columns=\meta{columns} (initially 1), group/rows=\meta{rows} (initially 1)} These keys determines the total number of plots that can be in one environment |groupplot|. It is thus important not to add more - \textbackslash|nextgroupplot| in the environment than \meta{columns}$\times$\meta{rows}. This is critical to set if one uses more than 1 more plot. As + |\nextgroupplot| in the environment than \meta{columns}$\times$\meta{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|. \end{pgfplotskeylist} @@ -163,8 +168,46 @@ All the following keys are in the subdirectory |group|. This style is used on every plot as the first style. It is thus equivalent as \meta{options} in the |groupplot| environment. \end{pgfplotskey} -\begin{pgfplotskeylist}{group/xticklabels at=\mchoice{all,edge top,edge bottom} (initially all),% - group/yticklabels at=\mchoice{all,edge left,edge right} (initially all)} +\begin{pgfplotskeylist}{% + group/xlabels at=\mchoice{all,edge bottom,edge top} (initially all),% + group/ylabels at=\mchoice{all,edge left,edge right} (initially all)} + In order to determine which plots get labels typeset one can use these keys. By default all axis gets typeset normally and thus have both $x$ and + $y$ axis labels. +% \usepgfplotslibrary{groupplots} +\begin{codeexample}[] +\begin{tikzpicture} + \begin{groupplot}[ + group style={ + group name=my plots, + group size=2 by 2, + xlabels at=edge bottom, + ylabels at=edge left, + }, + footnotesize, + width=4cm, + height=4cm, + % + xlabel=time $t$ / h, + ylabel=$c$ / mol/L, + ] + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \end{groupplot} +\end{tikzpicture} +\end{codeexample} +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 \textit{glued} plots. +\end{pgfplotskeylist} + +\begin{pgfplotskeylist}{% + group/xticklabels at=\mchoice{all,edge top,edge bottom} (initially all),% + group/yticklabels at=\mchoice{all,edge left,edge right} (initially all)} In order to determine which plots get tick labels typeset one can use these keys. By default all axis gets typeset normally and thus have both $x$ and $y$ axis tick labels. If one sets @@ -173,6 +216,52 @@ All the following keys are in the subdirectory |group|. \end{codeexample} 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 \textit{glued} plots. + + Keep in mind that this is implies the same ticks for all plots. +\end{pgfplotskeylist} + +\begin{pgfplotskeylist}{% + group/x descriptions at=\mchoice{all,edge top,edge bottom} (initially all),% + group/y descriptions at=\mchoice{all,edge left,edge right} (initially all)} + These are simply a short hand for both using both |xticklabels at| and |xlabels at| simultaneously: + +% \usepgfplotslibrary{groupplots} +\begin{codeexample}[] +\begin{tikzpicture} + \begin{groupplot}[ + group style={ + group name=my plots, + group size=2 by 2, + % + x descriptions at=edge bottom, + y descriptions at=edge right, + horizontal sep=0.5cm, + vertical sep=0.5cm, + }, + footnotesize, + width=4cm, + height=4cm, + % + xlabel=time $t$ / h, + ylabel=$c$ / mol/L, + ] + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \end{groupplot} +\end{tikzpicture} +\end{codeexample} + +Here, |x descriptions at=edge bottom| yields that $x$ descriptions (|xlabel| and |xticklabel|) are only used for the lowest row. Furthermore, |y descriptions at=edge right| places $y$ descriptions only for the rightmost column. Consider modifying the |horizontal sep| and |vertical sep| for your needs. + + As for |xticklabels at|, usage of this key implies the same ticks for all plots. + + This might \emph{require} |compat=1.3| (or newer). \end{pgfplotskeylist} \begin{pgfplotskey}{group/group name=\marg{name} (initially group)} @@ -205,7 +294,7 @@ specially handy when using \textit{glued} plots. \end{pgfplotskey} \begin{pgfplotskey}{group/empty plot/.style=\marg{style} (initially /pgfplots/hide axis)} - This key can be used as an option to the command \textbackslash|nextgroupplot|. This makes the next plot invisible (only the axes) but maintains it anchors and + 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. % \usepgfplotslibrary{groupplots} \begin{codeexample}[] @@ -231,5 +320,6 @@ specially handy when using \textit{glued} plots. circle (3pt) node {North west}; \end{tikzpicture} \end{codeexample} -Notice that you need to call a \textbackslash|nextgroupplot| again after to jump to the next plot. +Notice that you need to call a |\nextgroupplot| again after to jump to the next plot. \end{pgfplotskey} +} |