Pgfplots ボックス プロット: 外れ値のスタイルを変更する

Pgfplots ボックス プロット: 外れ値のスタイルを変更する

私は複数のボックス プロット (ファイルから読み取ったデータ) をプロットしようとしていますが、それらを同じように表示したいと考えています。外れ値以外のすべてに対してこれを実現できましたが、外れ値にはデフォルトのスタイル/カラーマップが使用されています (下の図を参照)。

外見を変えるにはどうすればいいですか?

ここに画像の説明を入力してください

ムウェ

\documentclass{minimal}
\usepackage{pgfplots}
\usepgfplotslibrary{statistics}

\begin{document}

   \begin{tikzpicture}
   \begin{axis}[y=1cm]
      \foreach \n in {1,...,8}
      {
      \addplot+ [boxplot,draw=black,solid,fill=white] table [row sep=\\,y index=0] 
         {
         data\\
         1\\ 2\\ 1\\ 5\\ 20\\ 10\\
         7\\ 10\\ 9\\ 8\\ 9\\ 9\\
         };
      }
   \end{axis}
   \end{tikzpicture}
\end{document}

答え1

希望を実現する方法はたくさんあります。 1 つの方法は、カスタム スタイルを作成し、それにすべてのオプション/キーを追加することです。

% used PGFPlots v1.16
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \usepgfplotslibrary{statistics}
    \pgfplotsset{
        compat=1.3,
        % create a custom style for the boxplots
        my boxplot style/.style={
            boxplot,
            draw=black,
            solid,
            fill=white,
            % -------------------------------------------------------------
            % add your desired mark symbol and mark style here
            mark=*,
            every mark/.append style={
                fill=gray,
            },
            % -------------------------------------------------------------
        },
    }
\begin{document}
\begin{tikzpicture}
   \begin{axis}
        \foreach \n in {1,...,8} {
            \addplot+ [
                % apply the custom style
                my boxplot style,
            ] table [row sep=\\,y index=0] {
                data\\
                1\\ 2\\ 1\\ 5\\ 20\\ 10\\
                7\\ 10\\ 9\\ 8\\ 9\\ 9\\
            };
        }
   \end{axis}
\end{tikzpicture}
\end{document}

上記コードの結果を示す画像

関連情報