# draw angle of Inclination

Καλημέρα!!

I 'm trying to draw a line with the angle of inclination, but nothing happens. What am I doing wrong?

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz,pgfplots}

\usetikzlibrary{calc,patterns,angles,quotes}

\begin{document}
\begin{tikzpicture}[>=latex]
\begin{axis}[
ticks=none,
axis x line=center,
axis y line=center,
xlabel={$x$},
ylabel={$y$},
xlabel style={below right},
ylabel style={above left},
xmin=-2,
xmax=2,
ymin=-0.5,
ymax=3]
\addplot [domain=-2:2,ultra thick] {2*x+1} node [pos=0.95, below left] {$C_f$};
\coordinate (A) at (0,1);
\coordinate (B) at (-0.5,0);
\coordinate (C) at (5,0);
\pic [draw, ->, "angle name", angle radius=1, angle eccentricity=1.5] {angle = C--B--A};
\end{axis}

\end{tikzpicture}
\end{document}


It is because you are running in the old compatibility mode. If you insist on this, you'd need to prepend axis cs: to your coordinates. However, I would like to argue that it is easier to switch to a newer version, which can be achieved by adding \pgfplotsset{compat=1.16}. (I also gave your angle the name \varphi, but of course you could go back to angle name.)

\documentclass{article}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.16}
\usetikzlibrary{calc,patterns,angles,quotes}

\begin{document}
\begin{tikzpicture}[>=latex]
\begin{axis}[
ticks=none,
axis x line=center,
axis y line=center,
xlabel={$x$},
ylabel={$y$},
xlabel style={below right},
ylabel style={above left},
xmin=-2,
xmax=2,
ymin=-0.5,
ymax=3]
\addplot [domain=-2:2,ultra thick] {2*x+1} node [pos=0.95, below left] {$C_f$};
\coordinate (A) at (0,1);
\coordinate (B) at (-0.5,0);
\coordinate (C) at (5,0);
\pic [draw, ->, "$\varphi$", angle radius=1cm, angle eccentricity=1.5]
{angle = C--B--A};
\end{axis}

\end{tikzpicture}
\end{document}


• Excellent!!! Thank's a lot!!! All working fine! P.S.: What is "compatibility mode"? – Kώστας Κούδας Dec 12 '18 at 20:48
• @ΚώσταςΚούδας There are various versions of pgfplots, which are not downward compatible. If you use pgfplots without setting any compat, it will use the original version. Later versions do no longer require to prepend axis cs: (and also have other advantages). BTW, if this answer worked for you, could you perhaps consider accepting it by clicking on the check mark left of it? – marmot Dec 12 '18 at 21:01

A PSTricks solution only for comparison purposes.

\documentclass[pstricks,border=1pt]{standalone}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}(-2,-1)(1.4,3.4)
\psaxes[ticks=none,labels=none]{->}(0,0)(-2,-1)(1,3)[$x$,0][$y$,90]
\psplot[algebraic]{-1.4}{.4}{2*x+2}
\psarc{->}(-1,0){.7}{0}{!2 1 atan}
\uput{.3}[!2 1 atan 2 div](-1,0){$\varphi$}
\end{pspicture}
\end{document}