[plotting] subplots done

This commit is contained in:
Jan Grewe 2017-11-08 17:37:58 +01:00
parent ddfeef151d
commit d712103a75
2 changed files with 58 additions and 7 deletions

View File

@ -434,20 +434,71 @@ the last one defines the output format (box\,\ref{graphicsformatbox}).
efficient.
\end{ibox}
\lstinputlisting[caption={Skript zur Erstellung des Plots in
\lstinputlisting[caption={Script for creating the plot shown in
\figref{spikedetectionfig}.},
label=niceplotlisting]{automatic_plot.m}
Next to the standard line plots there are many more options to display
scientific data. Mathworks shows various examples and the respective
code on their website
\url{http://www.mathworks.de/discovery/gallery.html}.
\section{Plot examples}
So far we have introduced the simple line plots.
So far we have introduced the standard line plots. Next to these there
are many more options to display scientific data. Mathworks shows
various examples and the respective code on their website
\url{http://www.mathworks.de/discovery/gallery.html}.
For some types of plots we present examples in the following sections.
\subsection{Line plot, subplots}
A very common scenario is to combine several plots in the same
figure. To do this we create so-called subplots
figures\,\ref{regularsubplotsfig},\,\ref{irregularsubplotsfig}. The
\code[subplot()]{subplot()} command allows to place multiple axes onto
a single paper. Generally, \varcode{subplot} expects three argument
defining the number of rows, column, and the currently active
plot. The currently active plot number starts with 1 and goes up to
$rows \cdot columns$ (numbers in the subplots in
figures\,\ref{regularsubplotsfig}, \ref{irregularsubplotsfig}).
\begin{figure}[t]
\includegraphics[width=0.5\linewidth]{regular_subplot}
\titlecaption{Subplots placed on a regular grid.}{By default all
subplots have the same size. See
listing\,\ref{regularsubplotlisting}. Subplot labeling has been
created using the \code[text()]{text()} annotation function (see
also below).}\label{regularsubplotsfig}
\end{figure}
\lstinputlisting[caption={Script for creating subplots in a regular
grid \figref{regularsubplotsfig}.}, label=regularsubplotlisting,
basicstyle=\ttfamily\scriptsize]{regular_subplot.m}
By default, all suplots have the same size, if something else is
desired, e.g., one suplot should span a whole row, while two others
are smaller and placed side by side in the same row, the third
argument of \varcode{subplot} can be a vector or numbers that should
be joined. These have, of course, be adjacent numbers
(\figref{irregularsubplotsfig},
listing\,\ref{irregularsubplotslisting}).
\begin{figure}[ht]
\includegraphics[width=0.5\linewidth]{irregular_subplot}
\titlecaption{Subplots of different size.}{The third argument of
\varcode{subpot} may be a vector of cells that should be joined
into the same subplot. See
listing\,\ref{irregularsubplotslisting}}\label{irregularsubplotsfig}
\end{figure}
Not all cells of the grid, defined by the number of rows and
columns, need to be used in a plot. If you want to create something
more elaborate, or have more spacing between the subplots one can
create a grid with larger numbers of columns and rows, and specify the
used cells of the grid by passing a vector as the third argument to
\varcode{subplot}.
\lstinputlisting[caption={Script for creating subplots of different
sizes \figref{irregularsubplotsfig}.},
label=irregularsubplotslisting,
basicstyle=\ttfamily\scriptsize]{irregular_subplot.m}
\subsection{Annotations, text}