Plotausrichtung mit Groupplot in pgfplots

Plotausrichtung mit Groupplot in pgfplots

Ich verwende die groupplotsBibliothek, pgfplotsum Plotgruppen zu erstellen. Ich verwende die Größe 2x2, habe aber nur 3 Plots. Wie kann ich den am weitesten rechts gelegenen Plot vertikal zentrieren, um ein Dreieck statt eines umgedrehten zu erstellen?M? In einem anderen Fall möchte ich das untere Diagramm horizontal zentrieren. Würde dies dasselbe Verfahren erfordern? Gibt es ein besseres Werkzeug als 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}

Antwort1

Dank Jakes Vorschlag ist eine erhebliche Komprimierung meiner ursprünglichen Lösung möglich (da ich nichts über Tikz weiß). Außerdem stackenginesollte dieses Wochenende eine neue Version auf den Markt kommen. Die hier verwendete Syntax funktioniert sowohl in der alten als auch in der neuen Version. Sie können den Abstand zwischen den Plots bei Bedarf steuern (d. h. normales hspacing funktioniert zwischen den beiden oberen Plots und ein optionales Längenargument definiert \stackunderden vertikalen Abstand).

\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}

Bildbeschreibung hier eingeben

verwandte Informationen