pgfplots icon indicating copy to clipboard operation
pgfplots copied to clipboard

`scatter/@pre marker code` uses wrong transformation

Open schtandard opened this issue 1 year ago • 1 comments

According to the documentation, the coordinate system inside scatter/@pre marker code is transformed such that (0,0) is the plot coordinate. However, this does not seem to be the case.

\documentclass{article}

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

\begin{document}

\begin{tikzpicture}
  \begin{axis} [
        scatter,
        scatter/@pre marker code/.append code={
          \draw (0,0) circle [radius=.2cm];
        },
      ]
    \addplot+ {x^2 - 5};
  \end{axis}
\end{tikzpicture}

\end{document}

image

There's an additional offset. From playing around with the function a bit it seems like, modulo some rounding/imprecision, the offset is (xmin, ymin), where xmin (ymin) is the minimum of the data's x (y) coordinates.

schtandard avatar Jul 07 '24 18:07 schtandard

After playing around a bit more, it seems like error bars also feed into (xmin, ymin), so it's probably just the minimum of the data ranges (i.e. the lower left corner of the data area).

schtandard avatar Jul 07 '24 18:07 schtandard