I'm trying to put a node rotated parallel to a line y = 5 + x. Obviously, I expected the angle of rotation would be 45.
\documentclass[dvipsnames]{article}
\usepackage{pgfplots}
\usetikzlibrary{babel,calc,backgrounds,quotes,angles,patterns,decorations.markings,intersections,arrows,arrows.meta}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = middle,
xmin = -1,
ymin = -5,
xmax = 10,
ymax = 14,
domain = -1:10,
xtick = {1,2,...,9},
ytick = \empty,
xlabel style={below right},
ylabel style={above left},
x tick label style={below},
xlabel = {$x$},
ylabel = {$f$}
]
\addplot[very thick, domain=0:11] {5 + x};
\draw node[above,rotate=45] at (4, 9) {$v = v_0 + at$};
\end{axis}
\end{tikzpicture}
\end{document}
The result is:
I've played with different angles and find appropriate one: 27. But it depends on ymin/ymax of axis environment. How to make tikz draw node at right angle (so it's parallel to the line) with auto correction to ymin/ymax?
Thanks in advance