Beamer에서 pgfplot의 groupplot에 플롯 너비 오류가 발생했습니다.

Beamer에서 pgfplot의 groupplot에 플롯 너비 오류가 발생했습니다.

저는 비머 슬라이드에 3x3 플롯 행렬을 만들고 있습니다. 위치 (1,1)은 비어 있고 첫 번째 행의 나머지 부분에는 열 제목이 있고 첫 번째 열의 나머지 부분에는 행 제목이 있습니다. 위치 (2,2) ~ (3,3)에는 실제 플롯이 포함되어 있습니다. 나는 그러한 행렬을 만들기 위해 groupplots( 1.12)를 사용하고 있습니다.pgfplots

다음 두 가지 오류 메시지가 나타납니다.

패키지 pgfplots 경고: (y 방향으로) 빈 범위의 축이 있습니다. 이를 기본 범위로 바꾸고 모든 플롯을 지웁니다. 입력 라인 139에서.

! 패키지 pgfplots 오류: 오류: 플롯 너비 '28.45274pt'가 너무 작습니다. 라벨의 일정한 크기를 유지하는 동안에는 구현할 수 없습니다. 죄송합니다. 라벨 크기는 대략적인 것입니다. 너비를 조정해야합니다 ..

두 번째 오류의 경우 너비를 어디에서 늘려야할지 잘 모르겠습니다. 위에서 언급한 오류가 발생하지 않도록 코드를 수정하도록 도와주실 수 있나요?

의도한 결과는 다음 이미지입니다.

의도된 결과

지금까지 내 코드는 다음과 같습니다.

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

미리 감사드립니다!

답변1

\nextgroupplot등을 삽입하기 위해 공백을 사용할 필요는 없습니다 Row 1. 그러나 다음과 같은 노드를 사용하십시오.

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

너비 문제는 매우 작고 그것에 대해 불평하는 width=1cm빈 s에 등이 있기 때문에 발생합니다 .\nextgroupplotpgfplots

세련된 코드는 다음과 같습니다.

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

여기에 이미지 설명을 입력하세요

관련 정보