Plotbreitenfehler mit dem Gruppenplot von pgfplot in Beamer

Plotbreitenfehler mit dem Gruppenplot von pgfplot in Beamer

Ich erstelle eine 3x3-Matrix von Diagrammen in einer Beamer-Folie. Position (1,1) ist leer, der Rest der ersten Zeile enthält Spaltenüberschriften und der Rest der ersten Spalte enthält Zeilenüberschriften. Die Positionen (2,2) bis (3,3) enthalten tatsächliche Diagramme. Ich verwende groupplots( pgfplots1.12), um eine solche Matrix zu erstellen.

Ich erhalte die folgenden zwei Fehlermeldungen:

Paket pgfplots Warnung: Sie haben eine Achse mit leerem Bereich (in y-Richtung). Ersetzen Sie sie durch einen Standardbereich und löschen Sie alle Diagramme. in Eingabezeile 139.

! Fehler im Paket pgfplots: Fehler: Die Plotbreite „28.45274pt“ ist zu klein. Dies kann nicht implementiert werden, während die Größe der Beschriftungen konstant bleibt. Leider sind die Beschriftungsgrößen nur ungefähre Werte. Sie müssen Ihre Breite anpassen.

Beim zweiten Fehler weiß ich nicht so recht, wo ich die Breite vergrößern soll. Können Sie mir bitte helfen, meinen Code zu reparieren, damit ich die oben genannten Fehler nicht bekomme?

Das beabsichtigte Ergebnis ist das folgende Bild.

Beabsichtigtes Ergebnis

Mein Code sieht bisher wie folgt aus:

\documentclass{beamer}

\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}

\pgfplotsset{compat=1.12}

\pgfmathdeclarefunction{gauss}{2}{%
  \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}


\begin{document}

\begin{frame}{Distribution Matrix}

\begin{tikzpicture}
\begin{groupplot}[
        group style={
            group name=my plots,
            group size=3 by 3,
        },
        footnotesize,
        tickpos=left,
        ytick align=outside,
        xtick align=outside,
        enlarge x limits=false 
    ]

\nextgroupplot[
            width=1cm,
            height=1cm,
            hide axis]

\nextgroupplot[
            width=5cm,
            height=1cm,
            no markers, domain=0:9, samples=100,
            axis line style = { draw = none },
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            xlabel={Column 1},
            ticks=none,
            axis on top]

\nextgroupplot[
            width=5cm,
            height=1cm,
            no markers, domain=0:9, samples=100,
            axis line style = { draw = none },
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            xlabel={Column 2},
            ticks=none,
            axis on top]

\nextgroupplot[
            width=1cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style = { draw = none },
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ylabel={Row 1},
            ticks=none,
            axis on top]

\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [very thick,cyan!50!black] {gauss(4,1)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [very thick,cyan!50!black] {gauss(4,1)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\nextgroupplot[
            width=1cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style = { draw = none },
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ylabel={Row 2},
            ticks=none,
            axis on top]    

\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [very thick,cyan!50!black] {gauss(4,1)};
    \addplot [thick,red, no markers] coordinates {(2.5,0) (2.5,0.4)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [dashed,very thick,cyan!50!black] {gauss(4,1)};
    \addplot [very thick,cyan!50!black] {gauss(5,1)};
    \addplot [thick,red, no markers] coordinates {(2.5,0) (2.5,0.4)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\end{groupplot}
\end{tikzpicture}
\end{frame}


\end{document}

Dank im Voraus!

Antwort1

Sie müssen nicht empty verwenden \nextgroupplot, um usw. einzufügen Row 1. Verwenden Sie stattdessen einen Knoten wie

\node[rotate=90,above=5mm] at (my plots c1r1.west) {Row 1};
\node[rotate=90,above=5mm] at (my plots c1r2.west) {Row 2};
\node[above=5mm] at (my plots c1r1.north) {Column 1};
\node[above=5mm] at (my plots c2r1.north) {Column 2};

Das Breitenproblem tritt auf, wenn Sie width=1cmdiese leeren \nextgroupplotS usw. haben, die sehr klein sind und pgfplotssich darüber beschweren.

Hier ist Ihr verfeinerter Code:

\documentclass{beamer}

\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}

\pgfplotsset{compat=1.12}

\pgfmathdeclarefunction{gauss}{2}{%
  \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}


\begin{document}

\begin{frame}{Distribution Matrix}
%\centering if you want to center this
\begin{tikzpicture}
\begin{groupplot}[
        group style={
            group name=my plots,
            group size=2 by 2,
        },
        footnotesize,
        tickpos=left,
        ytick align=outside,
        xtick align=outside,
        enlarge x limits=false
    ]


\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [very thick,cyan!50!black] {gauss(4,1)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [very thick,cyan!50!black] {gauss(4,1)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [very thick,cyan!50!black] {gauss(4,1)};
    \addplot [thick,red, no markers] coordinates {(2.5,0) (2.5,0.4)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\nextgroupplot[
            width=5cm,
            height=4cm,
            no markers, domain=0:9, samples=100,
            axis lines=center,
            axis line style={->},
            xlabel style={at={(axis description cs:0.5,-0.01)},anchor=north},
            ylabel style={at={(axis description cs:-0.01,0.5)},rotate=90,anchor=south},
            ticks=none,
            axis on top]
    \addplot [dashed,very thick,cyan!50!black] {gauss(4,1)};
    \addplot [very thick,cyan!50!black] {gauss(5,1)};
    \addplot [thick,red, no markers] coordinates {(2.5,0) (2.5,0.4)};
    \addplot [thick,red, no markers] coordinates {(5.5,0.0) (5.5,0.4)};

\end{groupplot}
\node[rotate=90,above=5mm] at (my plots c1r1.west) {Row 1};
\node[rotate=90,above=5mm] at (my plots c1r2.west) {Row 2};
\node[above=5mm] at (my plots c1r1.north) {Column 1};
\node[above=5mm] at (my plots c2r1.north) {Column 2};
\end{tikzpicture}
\end{frame}


\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen