我如何将坐标(此处为异常值)指定为黑点?方括号中的颜色已定义为黑色,如果我在方括号中插入“mark=*”,箱线图就会消失。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{tikz}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{statistics}
\pgfplotsset{compat=1.3}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
boxplot/draw direction=y,
xtick={1,2},
ymin={0},
ymax={890000},
]
\addplot+[color=black,
boxplot prepared={
median=231040,
upper quartile=307800,
lower quartile=189576,
upper whisker=568892,
lower whisker=92821
},
] coordinates {(1,790724)(1,603189)(1,574542)};
\addplot+[color=black,
boxplot prepared={
median=290626,
lower whisker=97525,
lower quartile=218151,
upper quartile=379487,
upper whisker=674757
},
] coordinates {(3,835414)(3,752967)(3,737438)(3,737438)};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{tikz}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{statistics}
\pgfplotsset{compat=1.3}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
boxplot/draw direction=y,
xtick={1,2},
ymin={0},
ymax={890000},
]
\addplot+[color=black,
mark=*,
mark options={black},
boxplot prepared={
median=231040,
upper quartile=307800,
lower quartile=189576,
upper whisker=568892,
lower whisker=92821
},
] coordinates {(1,790724)(1,603189)(1,574542)};
\addplot+[color=black,
mark=*,
mark options={black},
boxplot prepared={
median=290626,
lower whisker=97525,
lower quartile=218151,
upper quartile=379487,
upper whisker=674757
},
] coordinates {(3,835414)(3,752967)(3,737438)(3,737438)};
\end{axis}
\end{tikzpicture}
\end{document}