1

In response to this question asking about how pgfplots boxplots can be produced without outliers, this answer suggested a fix that does not seem to work anymore. (I am not the first to notice this as evidenced by a comment left below the answer.) The following MWE (taken from the answer):

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{statistics}
\begin{document}

\makeatletter
\pgfplotsset{
    boxplot/hide outliers/.code={
        \def\pgfplotsplothandlerboxplot@outlier{}%
    }
}
\makeatother

\begin{tikzpicture}
\begin{axis}[y=1cm, try min ticks=2]
\addplot+[boxplot]
table[row sep=\\,y index=0] {
data\\
1\\ 2\\ 1\\ 5\\ 4\\ 10\\
7\\ 10\\ 9\\ 8\\ 9\\ 9\\
21\\
};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[y=1cm, try min ticks=2]
\addplot+[boxplot, hide outliers]
table[row sep=\\,y index=0] {
data\\
1\\ 2\\ 1\\ 5\\ 4\\ 10\\
7\\ 10\\ 9\\ 8\\ 9\\ 9\\
21\\
};
\end{axis}
\end{tikzpicture}

\end{document}

gives the following error:

! Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I am g
oing to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.30 t
      able[row sep=\\,y index=0] {
? x

(I'm using MacTeX 2019.) I have two questions:

  1. How can this be fixed so I can remove the outliers?
  2. How can I remove outliers but show extrema (minima/maxima)?
Stefan Pinnow
  • 29,535
user1362373
  • 2,859
  • 1
    To 1. Instead of (just) writing hide outliers write /pgfplots/boxplot/hide outliers and it works fine. (But don't ask me when this broke and why.) I'll edit Jakes answer accordingly and add a comment. – Stefan Pinnow Aug 26 '19 at 14:14

0 Answers0