pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
http://pgfplots.sourceforge.net/
187 stars 33 forks source link

Relative coordinates do not work inside axis environment #439

Closed wehro closed 2 years ago

wehro commented 2 years ago

The line in the first picture points 3 cm to the right as expected. The line in the second picture points 4 cm to the right and 1 cm to the up, which is wrong.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
\draw (2,1)--+(3,0);
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[xmin=-1,xmax=7,ymin=-1,ymax=4]
\draw (2,1)--+(3,0);
\end{axis}
\end{tikzpicture}
\end{document}

axis

hmenke commented 2 years ago

I think you explicitly need axis direction cs: for relative coordinates. Please have a look in the manual.

hmenke commented 2 years ago

Screenshot from 2022-06-08 19-07-04