How do I draw an angle with a label between two lines when the lines are not necessarily drawn in the same \draw
call?
I need to draw an angle with a label, theta, between the y-axis and the pendulum string (see picture below).
Other suggestions/improvements of my code/diagram are welcome.
Current code:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{calc,patterns}
\begin{document}
\begin{tikzpicture}
\coordinate (origo) at (0,0);
\coordinate (pivot) at (1,5);
% draw axes
\fill[black] (origo) circle (0.05);
\draw[thick,gray,->] (origo) -- ++(4,0) node[black,right] {$x$};
\draw[thick,gray,->] (origo) -- ++(0,-4) node[black,below] {$y$};
% draw roof
\fill[pattern = north east lines] ($ (origo) + (-1,0) $) rectangle ($ (origo) + (1,0.5) $);
\draw[thick] ($ (origo) + (-1,0) $) -- ($ (origo) + (1,0) $);
\draw[thick] (origo) -- ++(300:3) coordinate (bob);
\fill (bob) circle (0.2);
\end{tikzpicture}
\end{document}
Current output:
For illustration, I want something like this in my diagram:
Best Answer
You can use the
angles
library which defines apic
for this purpose. Thequotes
library is used for ease of labelling.If you want the angle in red with two-way arrows, just modify the last line:
EDIT (Respond to query in comments)
To change the colour of the label as well, just set the
text
key: