Skip to content

Instantly share code, notes, and snippets.

@anderflash
Created February 22, 2017 16:46
Show Gist options
  • Save anderflash/c419338b55f19a5db53785dcb618d844 to your computer and use it in GitHub Desktop.
Save anderflash/c419338b55f19a5db53785dcb618d844 to your computer and use it in GitHub Desktop.
Stack PGFPlots Vertically
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
group size=1 by 3,
xlabels at=edge bottom,
xticklabels at=edge bottom,
vertical sep=0pt
},
ybar,
footnotesize,
width=8cm,
height=3cm,
xlabel=Site,
xmin=-0.5, xmax=10.5,
ymin=0, ymax=29,
xtick={0,1,...,12},
xticklabels={A,B,C,D,E,F,G,H,I,J,K},
tickpos=left,
ytick align=outside,
xtick align=outside
]
\nextgroupplot[ymax=11]
\addplot [fill=blue] coordinates{(0,0) (1,9.94) (2,0.72)(3,1.17)(4,1.05)(5,0.67)(6,0.24)(7,1.75)(8,0)(9,0)(10,1.21)(11,0)};
\nextgroupplot
\addplot [fill=red] coordinates{(0,0) (1,14.04) (2,0.72)(3,0)(4,22.81)(5,3.34)(6,2.05)(7,11.23)(8,2.59)(9,0)(10,0.61)(11,0)};
\nextgroupplot[ymax=5]
\addplot [fill=red] coordinates{(0,0) (1,0) (2,0)(3,0)(4,0.53)(5,0.33)(6,0.73)(7,0)(8,0)(9,0)(10,3.9)(11,0.17)};
\end{groupplot}
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment