我想使用 来可视化数据pgfplot
boxplots
。我正在使用prepared
箱线图。我唯一的问题是我不知道如何正确自定义箱线图的 x 轴值。x 轴值应该是128, 256, 512, 1024
。我已经尝试了该draw position
选项,但箱线图变得很拥挤:
最小工作示例:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepgfplotslibrary{statistics}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
boxplot/draw direction=y,
]
\addplot+ [boxplot prepared={
draw position =128,
lower whisker =649,
lower quartile =749,
median =829,
upper quartile =990,
upper whisker =3171
},] coordinates {};
\addplot+ [boxplot prepared={
draw position =256,
lower whisker =653,
lower quartile =761,
median =898,
upper quartile =1031,
upper whisker =3104},
] coordinates {};
\addplot+ [boxplot prepared={
draw position =512,
lower whisker =782,
lower quartile =812,
median =835,
upper quartile =1144,
upper whisker =2418},
] coordinates {};
\addplot+ [boxplot prepared={
draw position =1024,
lower whisker =822,
lower quartile =826,
median =952,
upper quartile =1208,
upper whisker =4454},
] coordinates {};
\end{axis}
\end{tikzpicture}
\end{document}