In order to complete a handout I was preparing, I wrote the code below (MWE):
\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{calc,angles,positioning,decorations.pathreplacing}
\begin{document}
\newcounter{angle}
\setcounter{angle}{135}
\begin{tikzpicture}
%--------------------------------------------------------------------------------------------
%Axis
\draw[thick,-stealth,black] (-3.7,0)--(3.7,0) node[below] {$x$}; % x axis
\draw[thick,-stealth,black] (0,-3.7)--(0,3.7) node[left] {$y$}; % y axis
%--------------------------------------------------------------------------------------------
% Unit Circle
\draw[black] (0,0) circle (2cm);
\node[black,below] at (2.2,0) {1};
%--------------------------------------------------------------------------------------------
% Circle of Radius R
\draw[black] (0,0) circle (3cm);
\node[black,below] at (3.2,0) {$r$};
%--------------------------------------------------------------------------------------------
%
\draw[-stealth] (1,0) arc (0:\theangle:1) node at ($(\theangle/2:0.7)$) {$\theta$};
%--------------------------------------------------------------------------------------------
\draw[dashed] (\theangle:2cm) -- (\theangle:2cm |- 0,0) coordinate (A) node [midway, left]{$y^\prime$}; % vertical line
\draw[thick,rotate=\theangle] (0,0) -- (2,0);%
\filldraw[black] (\theangle:2cm) circle(1pt);
\filldraw[black] (A) circle(1pt);
\draw (\theangle:2cm) node[above=2pt,xshift=2pt] {$P^\prime$};
\node[xshift=-0.75cm, below] (A) {$x^\prime$};
%--------------------------------------------------------------------------------------------
\draw[thick,rotate=\theangle] (0,0) -- (3,0);
\filldraw[black] (\theangle:3cm) circle(1pt);
\draw (\theangle:3cm) node[above=2pt] {$P$};
\draw[dashed] (\theangle:3cm) -- (\theangle:3cm |- 0,0) coordinate (B) node [midway, left]{$y$};
\filldraw[black] (B) circle(1pt);
\draw [decoration={brace,raise=17pt}, decorate,thick,rotate=\theangle] (0,0) -- (B)
node [midway, below=4.5ex]{$x$};%
\end{tikzpicture}
\end{document}
But I feel the code is a bit messy. Can you assist me in achieving the same result but with a more compact and robust code?
Here is an image of the result above:







blackindraw. It is default color. – Sigur Dec 21 '19 at 16:44\draw[thick,rotate=\theangle] (0,0) -- (2,0);%– AndréC Dec 21 '19 at 16:49