更改箱线图大小

更改箱线图大小

如图所示,箱线图在 y 方向上的高度过大。我该如何调整?

设置:

\documentclass[final, english, ngerman, a4paper, 12pt, numbers=noenddot,
cd=true,
cdfont=false,cdfont=nohead,cdfont=nodin,
cdmath=false,
cdhead=false,
cdfoot=true,
cdcover=monochrome,
cdgeometry=asymmetric,
declaration=heading,
declaration=notoc,
abstract=heading
]
\usepackage{tikz,pgfplots}
    \pgfplotsset{compat=newest}
    \usepgfplotslibrary{statistics}
    \pgfplotsset{
        my boxplot style/.style={
            boxplot,
            draw=black,
            solid,
            fill=white,
            mark=*,
            every mark/.append style={
                fill=white,
            },
        },
    }

文档中的 Tikzpicture:

\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=0.85]
  \begin{axis}
    [
    xlabel={Abweichung},
    xlabel style={below},
    ylabel style={above},
    yticklabels={,,}
    ]
    \addplot+[draw=black,my boxplot style,
    boxplot prepared={
      median=0.0728,
      upper quartile=0.1,
      lower quartile=0,
      upper whisker=0.25,
      lower whisker=-0.13
    },
    ] coordinates {
    (1,0.5)
    (1,-0.3)
    (1,0.2857)
    };
  \end{axis}
\end{tikzpicture}
\end{figure}

\end{document}

在此处输入图片描述

先感谢您!

答案1

\documentclass[border=1 cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{statistics}
\pgfplotsset{
        my boxplot style/.style={
            boxplot,
            draw=black,
            solid,
            fill=white,
            mark=*,
            every mark/.append style={
                fill=white,
            },
        },
    }

\begin{document}
\begin{tikzpicture}
\begin{axis}[
yticklabels=\empty,
y post scale=0.3,
]
\addplot+[draw=black, my boxplot style,
boxplot prepared={
      median=0.0728,
      upper quartile=0.1,
      lower quartile=0,
      upper whisker=0.25,
      lower whisker=-0.13
},
] coordinates {(1,0.5) (1,-0.3) (1,0.2857)};
\end{axis}
\end{tikzpicture}
\end{document}

高度较低的箱线图

相关内容