2

I have the following code:

\documentclass{standalone}

\usepackage{tikz}
  \usetikzlibrary{math,arrows.meta}

\begin{document}

  \tikzmath{\radiusarrow = 3;
            \radiusmax = 4;}
  \centering
  \begin{tikzpicture}[>=stealth]

     \draw (0,0) circle (\radiusmax) ;

    \foreach \ang/\lab/\dir in {
      0/right,      
      15/right,
      30/{above right},
      45/{above right},
      60/{above right},
      75/above,
      90/above,
      105/above,
      120/{above},
      135/{above left},
      150/left,
      165/left,
      180/left,
      195/{below left},
      210/below,
      225/below,
      240/below,
      255/{below},
      270/{below},
      285/right,
      300/right,
      315/right,
      330/right,
      345/right} {
       \draw [dashed,lightgray] (0,0) -- (\ang:\radiusmax) ;
       \node at (\ang:\radiusmax) [\dir] {\ang$^\circ$}; % label
     }

     \draw[-{Latex[length=3cm, width=13]},red] (255:\radiusarrow) -- (0,0) ;
     \draw[-{Latex[length=3cm, width=13]},red] (315:\radiusarrow) -- (0,0) ;
  \end{tikzpicture} 

\end{document}

This code draws a circle and labels it with the polar angles. It draws also few arrows (triangles) from the circle edge to the centre. There are few things that I didn't succeed to achieve in this code:

  1. I didn't succeed to put the angle labels in a "beautiful" way, that is, at the same distance from the circle edge.

  2. As you can see, I have defined parameters (\radiusmax which is the circle radius and \radiusarrow which is the arrow length) in order I can change easily the size of the circle and of the arrows. However, this attempt is not completed because I still have to fix the arrow length (3cm) with the option length=3cm in the line:

    \draw[-{Latex[length=3cm, width=13]},red] (255:\radiusarrow) -- (0,0) ;
    

I have tried to write:

\draw[-{Latex[length=\radiusarrow, width=13]},red] (255:\radiusarrow) -- (0,0) ;

in order that the arrow length was fixed only at the beginning of the code. But this doesn't work.

  1. Have you noticed that the arrows do not reach perfectly the centre ?

Do you have any clue how to fix these issues ?

2

You may liked :-):

Edit: With use of Latex arrow head, they are not touch each other in center of circle. Replacing it by Triangle gives what you like to have:

\documentclass[tikz, margin=3.14159 mm]{standalone}
\usepackage{lmodern}
\usetikzlibrary{arrows.meta}
\usepackage{siunitx}

\begin{document}
    \begin{tikzpicture}[
arr/.style = {-{Triangle[length=\radiusarrow cm, width=25]}, red}
                        ]
\def\radiusarrow{3};
\def\radiusmax {4}
%%%
\draw (0,0) circle[radius=\radiusmax];
%
\foreach \i in {0,15,...,345}
{
\draw[densely dashed, gray] (\i:\radiusmax)   
     coordinate[label={[text=black, anchor=\i+180]\i:\SI{\i}{\degree}}] (c\i) 
                                        -- (0,0);
}
\draw[arr] (255:\radiusarrow) -- (0,0) ;
\draw[arr] (315:\radiusarrow) -- (0,0) ;
    \end{tikzpicture}
\end{document}

As you can see, instead nodes are used coordinates with labels, which anchors are anchor=\i+180, \i is angle of label position. For marking of angles are employed siunitx package: \SI{...}{\degree}.

enter image description here

and magnification of circle center:

enter image description here

| improve this answer | |
  • Thank you very much ! The labels are well positioned and I can now control easily the arrow length at the beginning of the code ! However, I still observe that the arrows do not meet each other at the center. – J. Martin Oct 19 at 15:20
  • 1
    @J.Martin, indid. This caused, as it seems, with features of selected arrow head. If you replace Latex with Triangle, yarrows will touch each other in center of circle. See edited answer. – Zarko Oct 19 at 15:57
4

Another possibility might be to set anchor=\ang+180 and use a circle node. For the length, you can multiply by 1cm, i.e. length=\radiusarrow*1cm. Not sure yet about #3.

\documentclass{standalone}

\usepackage{tikz}
  \usetikzlibrary{math,arrows.meta}

\begin{document}

  \tikzmath{\radiusarrow = 3;
            \radiusmax = 4;}
  \centering
  \begin{tikzpicture}[>=stealth]

     \draw (0,0) circle (\radiusmax) ;

    \foreach \ang in {0,15,...,345} {
       \draw [dashed,lightgray] (0,0) -- (\ang:\radiusmax) ;
       \node[circle, inner sep=1pt, anchor=\ang+180] at (\ang:\radiusmax)  {\ang$^\circ$}; % label
     }

     \draw[-{Latex[length=\radiusarrow*1cm, width=13]},red] (255:\radiusarrow) -- (0,0) ;
     \draw[-{Latex[length=\radiusarrow*1cm, width=13]},red] (315:\radiusarrow) -- (0,0) ;
  \end{tikzpicture} 

\end{document}
| improve this answer | |
  • Thank you very much ! The labels are well positioned and I can now control easily the arrow length at the beginning of the code ! However, I still observe that the arrows do not meet each other at the center. – J. Martin Oct 19 at 15:18
  • 1
    @J.Martin As I said, not sure about that. It does help if you make the arrow tips wider,as mentioned in one of the other answers. Possibly drawing a rectangle with \fill instead of using an arrow tip could help. – Torbjørn T. Oct 19 at 15:58
3

Remove the node anchoring ([\dir]) for angle labels. For arrows, I have increased the width value, like:

\documentclass{standalone}

\usepackage{tikz}
  \usetikzlibrary{math,arrows.meta}

\begin{document}

  \tikzmath{\radiusarrow = 3;
            \radiusmax = 4;}
  \centering
  \begin{tikzpicture}[>=stealth]

     \draw (0,0) circle (\radiusmax) ;

    \foreach \ang/\dir in {
      0/right,      
      15/right,
      30/{above right},
      45/{above right},
      60/{above right},
      75/above,
      90/above,
      105/above,
      120/{above},
      135/{above left},
      150/left,
      165/left,
      180/left,
      195/{below left},
      210/below,
      225/below,
      240/below,
      255/{below},
      270/{below},
      285/right,
      300/right,
      315/right,
      330/right,
      345/right} {
       \draw [dashed,lightgray] (0,0) -- (\ang:\radiusmax) ;
       \node at (\ang:\radiusmax+0.35){\ang$^\circ$}; % label
     }

     \draw[-{Latex[length=3cm, width=25]},red] (255:\radiusarrow) -- (0,0) ;
    \draw[-{Latex[length=3cm, width=25]},red] (315:\radiusarrow) -- (0,0) ;
  \end{tikzpicture} 

\end{document}

enter image description here

| improve this answer | |
  • Thank you very much for this answer.The labels are well positioned. However, you still have to change the length of the arrows one by one. – J. Martin Oct 19 at 15:14

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.