Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the groupplots library in pgfplots to create plot groupings. I am using the 2x2 sizing but only have 3 plots. How can I center the furthest right plot vertically, to make a triangle rather than an upside down L? In another case, I would like to center the bottom plot horizontally, would this use the same procedure? Is there a better tool to use than groupplots?

\documentclass{standalone}
\usepackage{tikz,pgfplots}
    \usepgfplotslibrary{groupplots}

\begin{document}
  \begin{tikzpicture}
    \begin{groupplot}[
      group style={group size=2 by 2},
      width=4cm, height=4cm,
    ]
    \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{document}
share|improve this question
2  
Groupplots really shines when your subplots use the same axes, because it allows you to only show the axes on the edges of the groups. For more general alignments like the one you're looking for, using separate axis or even tikzpicture environments might be a better way to go. –  Jake Jul 11 '13 at 17:49
    
Welcome to TeX.SX. –  Adam Liter Jul 11 '13 at 17:51
add comment

1 Answer

Thanks to Jake's suggestion, a significant compression of my original solution is possible (since I don't know a thing about tikz). Also, a new version of stackengine should hit the streets this weekend. The syntax I used here will work in both old and new versions. You can control the inter-plot separation, if desired (i.e., normal hspacing will work between the top two plots, and an optional length argument to \stackunder will define the vertical gap).

\documentclass{standalone}
\usepackage{stackengine}
\usepackage{tikz,pgfplots}
    \usepgfplotslibrary{groupplots}
\begin{document}
\stackunder{%
  \begin{tikzpicture}
    \begin{axis}[width=4cm, height=4cm] \addplot coordinates{%
      (0,0) (1,2) (2,1)}; \end{axis}
  \end{tikzpicture}
  \begin{tikzpicture}
    \begin{axis}[width=4cm, height=4cm] \addplot coordinates{%
      (0,0) (1,2) (2,1)}; \end{axis}
  \end{tikzpicture}
}{%
  \begin{tikzpicture}
    \begin{axis}[width=4cm, height=4cm] \addplot coordinates{%
      (0,0) (1,2) (2,1)}; \end{axis}
  \end{tikzpicture}
}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.