# how to draw a phasor diagram (like this picture)

Hi, I would like to draw this phase diagram as in the attached picture. But some examples I see in the internet are so different (more complex) and when I choose one way to follow I don't know how to add angles and letters as the picture too.

Here what I did since now (second picture):

    \usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[>=latex]
\draw[style=help lines] (0,0) (3,2);

\coordinate (vec1) at (300:1.5);
\coordinate (vec2) at (30:2.5);
\coordinate (vec3) at (0:2.5);
\coordinate (vec4) at (90:2);
\coordinate (vec5) at (270:2);
\coordinate (vec6) at (180:2);

\draw[->,thick,black] (0,0) -- (vec1);
\draw[->,thick,black] (0,0) -- (vec2);
\draw[->,thick,black] (0,0) -- (vec3);
\draw[->,thick,black] (0,0) -- (vec4);
\draw[->,thick,black] (0,0) -- (vec5);
\draw[->,thick,black] (0,0) -- (vec6);

\end{tikzpicture}
\end{center}
\end document


The easiest way to learn about arc construction is to use the verbose mode at first. So the command

\draw [red, thick] (1.0,0) arc [start angle=0, end angle=30, radius=1cm]
node [midway, right] {$\phi$};


says to start the arc at (1.0,0) with the provided parameters. A more concise way of saying that is to use

\draw [red, thick] (1.0,0) arc (0:30:1cm)
node [midway, right] {$\phi$};


where the parameter following the arc is (<start angle>:<end angle>:<radius>).

## Code: Verbose

\documentclass{article}
\usepackage{tikz}
\usepackage{siunitx}

\begin{document}
\begin{tikzpicture}[>=latex]
\draw[style=help lines] (0,0) (3,2);

\coordinate (vec1) at (300:1.5);
\coordinate (vec2) at (30:2.5);
\coordinate (vec3) at (0:2.5);
\coordinate (vec4) at (90:2);
\coordinate (vec5) at (270:2);
\coordinate (vec6) at (180:2);

\draw[->,thick,black] (0,0) -- (vec1) node[right] {$I$};
\draw[->,thick,black] (0,0) -- (vec2) node[below right] {$V$};
\draw[->,thick,black] (0,0) -- (vec3) node [below] {$Re$};
\draw[->,thick,black] (0,0) -- (vec4) node [left] {$Im$};
\draw[->,thick,black] (0,0) -- (vec5);
\draw[->,thick,black] (0,0) -- (vec6);

\draw [red, thick] (1.0,0) arc [start angle=0, end angle=30, radius=1cm]
node [midway, right] {$\phi$};

\draw [blue, thick] (0.5,0) arc [start angle=0, end angle=-60, radius=0.5cm]
node [midway, right] {$\phi-\ang{90}$};
\end{tikzpicture}
\end{document}


## Code: Concise:

\documentclass{article}
\usepackage{tikz}
\usepackage{siunitx}

\begin{document}
\begin{tikzpicture}[>=latex]
\draw[style=help lines] (0,0) (3,2);

\coordinate (vec1) at (300:1.5);
\coordinate (vec2) at (30:2.5);
\coordinate (vec3) at (0:2.5);
\coordinate (vec4) at (90:2);
\coordinate (vec5) at (270:2);
\coordinate (vec6) at (180:2);

\draw[->,thick,black] (0,0) -- (vec1) node[right] {$I$};
\draw[->,thick,black] (0,0) -- (vec2) node[below right] {$V$};
\draw[->,thick,black] (0,0) -- (vec3) node [below] {$Re$};
\draw[->,thick,black] (0,0) -- (vec4) node [left] {$Im$};
\draw[->,thick,black] (0,0) -- (vec5);
\draw[->,thick,black] (0,0) -- (vec6);

\draw [red, thick ] (1.0,0) arc (0:30:1cm)    node [midway, right] {$\phi$};
\draw [blue, thick] (0.5,0) arc (0:-60:0.5cm) node [midway, right] {$\phi-\ang{90}$};

\end{tikzpicture}
\end{document}


Command AngleMark has several options to mark the angles in different ways.

\documentclass{article}
\usepackage{xparse,tikz,siunitx}
\usetikzlibrary{calc}

\pgfkeys{/tikz/.cd,
MarkAngleDim/.store in=\MarkAngleDim,
MarkAngleDim=0.5,
MarkDim/.store in=\MarkDim,
MarkDim=2,
}

\makeatletter
\NewDocumentCommand{\AngleMark}{%
d<>     % secteur si vide ou traits avec le nombre de traits
O{}     % options de dessin
m       % liste des angles A/B/C
O{0}    % nb de marques
D<>{7pt}        % décalage du node
}{%
\foreach \Bn/\An/\Cn in {#3} {%
\pgfmathanglebetweenpoints%
{\pgfpointanchor{\An}{center}}%
{\pgfpointanchor{\Bn}{center}}%
\let\AnglA\pgfmathresult ;
\pgfmathanglebetweenpoints%
{\pgfpointanchor{\An}{center}}%
{\pgfpointanchor{\Cn}{center}}%
\let\AnglB\pgfmathresult ;
\pgfmathparse{ifthenelse(\AnglA>\AnglB,\AnglA-360,\AnglA)}          \global\let\AnglA\pgfmathresult ;

\IfNoValueTF{#1}{% Secteur à remplir
\path[very thin,#2] (\An) --
($(\An) !\MarkAngleDim cm!(\Bn)$)
arc (\AnglA:\AnglB:\MarkAngleDim)
node[pos=.5] (@ngle\Bn\An\Cn) {}
--cycle;}{% Trait simple
\path[very thin,#2] ($(\An) !\MarkAngleDim cm!(\Bn)$)
arc (\AnglA:\AnglB:\MarkAngleDim)
node[pos=.5] (@ngle\Bn\An\Cn) {} ;
}
% Node de quotation sur l'arc
\node (Angle\Bn\An\Cn) at
($(@ngle\Bn\An\Cn)!-#5!(\An)$) {} ;

\ifnum#4>0

\pgfmathanglebetweenpoints%
{\pgfpointanchor{\An}{center}}%
{\pgfpointanchor{Angle\Bn\An\Cn}{center}}%
\let\AnglC\pgfmathresult ;

\begin{scope}[shift={(\An)}]
\foreach \i [evaluate=\i as \ang
using \AnglC+2*(\i-#4/2-.5)/\MarkAngleDim]
in {1,...,#4} {%
\draw[very thin,#2] (\ang:\MarkAngleDim cm +\MarkDim pt)
--(\ang:\MarkAngleDim cm -\MarkDim pt) ;
}
\end{scope}
\fi
}
}
\makeatother

\begin{document}
\begin{center}
\begin{tikzpicture}[>=latex]
\draw[style=help lines] (0,0) (3,2);

\coordinate (vec1) at (300:1.5);
\coordinate (vec2) at (30:2.5);
\coordinate (vec3) at (0:2.5);
\coordinate (vec4) at (90:2);
\coordinate (vec5) at (270:2);
\coordinate (vec6) at (180:2);

\draw[->,thick,black] (0,0) coordinate (O) -- (vec1);
\draw[->,thick,black] (0,0) -- (vec2);
\draw[->,thick,black] (0,0) -- (vec3);
\draw[->,thick,black] (0,0) -- (vec4);
\draw[->,thick,black] (0,0) -- (vec5);
\draw[->,thick,black] (0,0) -- (vec6);

\AngleMark[draw,MarkAngleDim=.8]{vec3/O/vec2}
\node at (Anglevec3Ovec2) {$\phi$};

\AngleMark[draw]{vec1/O/vec3}<0pt>
\node[anchor=north west] at (Anglevec1Ovec3) {$\theta=\phi-\ang{90}$};

\end{tikzpicture}
\end{center}
\end{document}


one more solution:

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows,arrows.meta,quotes,angles}
\usepackage{siunitx}
\begin{document}
%%%% se-phasor
\begin{tikzpicture}[
> = angle 90,
phasor/.style = {very thick,-{Triangle[fill=white]}},
angles/.style = {draw, <->, angle eccentricity=1,
]
% coordinates
\draw[->] (-0.5,0) -- (4,0) coordinate (x) node[below left] {$Re$};
\draw[->] (0,-1.5) -- (0,2) node[below left] (y) {$Im$};
% phasors
\draw[phasor] (0,0) -- (300:1.5) coordinate (i)  node[right] {I};
\draw[phasor] (0,0) -- ( 30:2.5) coordinate (v)  node[right] {V};
% angles drawn by pic
\coordinate (X)   at (0,0);
\draw
pic["$\theta=\phi-\SI{90}{\degree}$",angles] {angle=i--X--x}
pic["$\phi$",angles] {angle=x--X--v}
;
\end{tikzpicture}
\end{document}


Here's a version of the original diagram in Metapost, with the text set in Times New Roman using the XITS font and the luamplib package.

You have to process this with lualatex, but this approach brings Unicode and OTF font handling to plain Metapost. Notice that you can still redefine things (like the arrowheads) as required.

\documentclass[margin=1cm]{standalone}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}

% redefine "_finarr" to get unfilled arrows
def _finarr text t =
draw _apth t;
enddef;

beginfig(1);

path xx, yy, vv, ii;

% axes
yy = (40 down -- 40 up);
xx = (15 left -- 120 right);
drawarrow(xx); label.bot(btex \textit{Re} etex, point infinity of xx);
drawarrow(yy); label.lft(btex \textit{Im} etex, point infinity of yy);

% vectors
phi = 28;
theta = phi - 90;
vv = origin -- 90 right rotated phi;
ii = origin -- 40 right rotated theta;
drawarrow(vv); label.rt(btex \textbf{V} etex, point infinity of vv);
drawarrow(ii); label.rt(btex \textbf{I} etex, point infinity of ii);

% angle marks
path angle_mark[];
angle_mark1 = fullcircle scaled 70 cutafter vv;
angle_mark2 = reverse fullcircle scaled 30 cutafter ii;
draw(angle_mark1);
draw(angle_mark2);
label.rt(btex $ϕ$       etex, point .5 of angle_mark1 + 2 up);
label.rt(btex $θ=ϕ-90°$ etex, point .5 of angle_mark2 + 4 down);

endfig;
\end{mplibcode}
\end{document}