pgfplots icon indicating copy to clipboard operation
pgfplots copied to clipboard

Error bar colors in scatter plots

Open schtandard opened this issue 7 months ago • 0 comments

Error bars in scatter plots should take the color of the data point. Or at least, realizing that effect should be made convenient.

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}

\begin{tikzpicture}
  \begin{axis} [
        scatter,
        error bars/y dir=both,
        error bars/y fixed=2,
      ]
    \addplot+ [domain=-5:5] {x^2};
  \end{axis}
\end{tikzpicture}

\end{document}

image

There are a couple of questions on tex.sx about this, most notably this one from 2013. The answer gives a usable workaround (though it is broken due to #483) but that is not ideal. In the comments, Christian Feuersänger mentions that he already implemented a proper fix, minus some fine tuning. I don't think that ever made it into a release, though; at least I can't find an option for it or an example in the manual.

schtandard avatar Jul 07 '24 19:07 schtandard