Como girar um nó para que fique paralelo a uma linha?

Como girar um nó para que fique paralelo a uma linha?

Estou tentando colocar um nó girado paralelamente a uma linha y = 5 + x. Obviamente, eu esperava que o ângulo de rotação fosse 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}

O resultado é:

insira a descrição da imagem aqui

Já brinquei com diferentes ângulos e encontrei um apropriado: 27. Mas depende de ymin/ymax do ambiente do eixo. Como fazer o nó tikz desenhar em ângulo reto (para que fique paralelo à linha) com correção automática para ymin/ymax?

desde já, obrigado

Responder1

Aqui você tem uma solução possível:

\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};
    \path (axis cs:0,5)-- node[above,sloped] {$v = v_0 + at$} (axis cs:9,14);
  \end{axis}
\end{tikzpicture}
\end{document}

insira a descrição da imagem aqui

informação relacionada