1

I'm struggling with the proper location of three angles. Here is the picture I want to draw: vectors and angles

And here is what I have so far:

\documentclass[12pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\begin{axis}[
x=1.0cm,y=1.0cm,
axis lines=middle,
xmin=-2,
xmax=4,
ymin=-2,
ymax=4,
xtick={-2.0,-1.0,...,4.0},
ytick={-2.0,-1.0,...,4.0},
]

%\draw [line width=.5pt,color=yellow,fill=yellow,fill opacity=0.11] (0,0) -- (0.:0.3) arc (0.:34:0.7) -- cycle;

\draw [shift={(-2,-2)},line width=.5pt,color=brown,fill=brown,fill opacity=0.11] (0,0) -- (0.:0.3) arc (0.:72:0.3) -- cycle;

\draw [shift={(-2,-2)},line width=.5pt,color=magenta,fill=magenta,fill opacity=0.11] (0,0) -- (33:0.3) arc (33:72:.4) -- cycle;

\draw [-latex] (0.,0.) -- (1.84,1.24);
\draw [-latex] (0.,0.) -- (0.82,2.54);

\begin{scriptsize}
\draw[color=black] (0.7,0.8) node {$\vec{u}$};
\draw[color=black] (0.3,1.52) node {$\vec{v}$};
%\draw[color=teal] (0.3,0.09) node {$\alpha$};
%\draw[color=red] (0.2,0.2) node {$\beta$};
%\draw[color=blue] (0.2,0.1) node {$\gamma$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}

which renders this:

desired pic

I know that all three angles have the same center (point [0;0]) but different radius. How can I achieve that? Thanks a lot!

3 Answers 3

2

The angles library is designed for this. It is helpful to also use the quotes library to make the syntax simpler:

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary {angles, quotes}

\begin{document}

\begin{tikzpicture}
             
\coordinate (o) at (0,0);
\coordinate (u) at (1.84,1.24);
\coordinate (v) at (0.82,2.54);
\coordinate (x) at (2,0);

\draw [-latex] (o) -- (u);
\draw [-latex] (o) -- (v);
\draw [-latex] (o) -- (x);

\path pic[draw=blue, angle radius=8mm, "$\alpha$", blue, angle eccentricity=.8]{angle=x--o--u};
\path pic[draw=red, angle radius=9mm, "$\beta$", red, angle eccentricity=.7]{angle=u--o--v};
\path pic[draw=teal, angle radius=10mm, "$\gamma$", below right, teal, angle eccentricity=1.1]{angle=x--o--v};

\end{tikzpicture}

\end{document}
2

Like this:

enter image description here

Code (the angle are calculated separetly):

\documentclass[10pt,a4paper]{article}
\usepackage{tikz,siunitx}

\sisetup{round-mode = places, round-precision = 1} % fix # of decimal places


\begin{document}
    \begin{tikzpicture}[scale=2]
        \draw[gray!20,step=.5] (-1,-1) grid (3,3);
        \draw[thin,-latex] (-1,0)--(3,0) node[right] () {$x$};
        \draw[thin,-latex] (0,-1)--(0,3) node[above] () {$y$};
        \foreach \i in {-1,-.5,.5,1,...,3}{
            \pgfmathsetmacro{\j}{\i}
            \draw (\i,0)--(\i,-.1) node[below] () {\num{\j}};
        }
        \foreach \i in {-1,-.5,.5,1,...,3}{
            \pgfmathsetmacro{\j}{\i}
            \draw (0,\i)--(-.1,\i) node[left] () {\num{\j}};
        }
        \draw[line width=2pt,-latex] (0,0)--(1.84,1.24);
        \draw[line width=2pt,-latex] (0,0)--(.82,2.54);
        \draw[red] (1,0)  arc(0:33.98:1) node[midway,fill=white] {\bfseries $\alpha$};
        \draw[blue] (33.98:1.2) arc(33.98:72.11:1.2) node[midway,fill=white] {\bfseries $\beta$};   
    \end{tikzpicture}   
\end{document}

If You want also the legends for the two vectors, modify thi two lines:

\draw[line width=2pt,-latex] (0,0)--(1.84,1.24) node[above] {$\vec{u}$};
\draw[line width=2pt,-latex] (0,0)--(.82,2.54) node[above] {$\vec{v}$};

New output:

enter image description here

1

An alternative with tkz-base and tkz-euclide

The code

\documentclass{article} 
%https://tex.stackexchange.com/questions/674228/tikz-arc-angles
\usepackage{tkz-base} 
\usepackage{tkz-euclide}
\begin{document} 
\begin{tikzpicture}[scale=1]
    \tkzInit[xmin=-2,xmax=4,ymin=-2,ymax=4]
    %\tkzGrid(-2,-2)(4,4)
    \tkzLabelX[orig=false]
    \tkzLabelY[orig=false]
    \tkzDrawXY
    %
    \tkzDefPoints{0/0/O,1.84/1.24/A,0.82/2.54/B,2/0/x}
    %
    \tkzDrawSegments[vector style](O,A O,B)
    \tkzLabelSegment[above,pos=.5](O,A){$\vec{u}$}
    \tkzLabelSegment[above left=-0.5ex,pos=.5](O,B){$\vec{v}$}
    %
    \tkzMarkAngle[size=0.65,color=teal](x,O,A)
    \tkzLabelAngle[pos=0.45,color=teal](x,O,A){$\alpha$}
    \tkzMarkAngle[size=.8,color=red](A,O,B)
    \tkzLabelAngle[pos=0.6,color=red](A,O,B){$\beta$}
    \tkzMarkAngle[size=.95,color=blue](x,O,B)
    \tkzLabelAngle[pos=1.15,color=blue,xshift=1ex,yshift=-1.5ex](x,O,B){$\gamma$}
    \end{tikzpicture}  
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.