Example: Group plot

Published 2014-03-28 | Author: Elke Schubert

A group plot example, posted by Elke Schubert on TeXwelt.de.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Group plot

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

\documentclass[margin=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepackage{pgfplotstable}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{tikzpicture}
  % Read the file
  % if needed, define column separators by pgfplotstableread[col sep=...]{}{}
 \pgfplotstableread{data.csv}{\Data}
 \begin{groupplot}[
     group style = {group size = 2 by 1},
     height = 10cm,
     width = 10cm,
     ymin = 500,
     xticklabels from table = {\Data}{Day}, xtick = {1,...,19},
     xticklabel style = {rotate = 90, xshift = -0.8ex, anchor = mid east}
    ]
    \nextgroupplot[xmin = 1, xmax = 19, ymax = 900]
      \addplot[very thick] table [x = Number, y = Orders] {\Data};
      \draw[red, dashed, thick] (axis cs:11,0) rectangle (axis cs:32,850);
    \nextgroupplot[xmin = 11, xmax = 19, ymax = 850, width = 5cm]
      \addplot[very thick] table [x = Number, y = Orders] {\Data};
  \end{groupplot}
  \draw[thick, blue, ->, shorten >=2pt, shorten <=2pt] (group c1r1.east)
  -- (group c2r1.west);
\end{tikzpicture}
\end{document}

Comments

Adding comments is currently not enabled.