I would like to add a main diagonal to a plot that does not affect the axis. The line should start and end at the axis or beyond them. Furthermore, I would like to avoid xmin
and xmax
, because I work with data tables. I tried relative coordinates rel axis cs
, but this does not result in a main diagonal (slope 1 and offset 0). Here is a minimal working example to start with:
\documentclass{scrartcl}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}
\begin{tikzpicture}
\centering
\pgfplotsset{width=0.9\columnwidth}
\begin{axis}
\addplot coordinates {(0,0.1)(1,2)(2,3)};
\end{axis}
\end{tikzpicture}
\end{document}
axiscs
in combination with\pgfkeysvalueof{/pgfplots/xmin}
and variants to produce the main diagonal. I believe this will only work if you draw the line after your plot your data. – sudosensei Nov 29 '13 at 9:40xmin
andxmax
, because my data comes from tables that can change. @Jack Yes, slope 1 and no offset. – Dirk Nov 29 '13 at 11:01:-)
– sudosensei Nov 29 '13 at 11:08