3

I would like to define a series of dots distributed around a circle and be able to define the number of points using tikz. Is it possibile without involving pstricks?

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw [draw=red, line width=2pt,dash pattern=on 5pt off 5pt] circle(5cm);
\end{tikzpicture}

\end{document}

enter image description here

  • 1
    Just use polar coordinates and a for loop to specify the angle. – daleif Feb 17 at 10:46
  • 2
    Try `` \foreach\n in {0,10,20,...,360-10} { \fill (\n:1) circle (1pt); }`` – daleif Feb 17 at 10:48
3

Something like this --replace black color with red

\documentclass[tikz,border=0.5cm]{standalone}
\begin{document}
\begin{tikzpicture}

\foreach \i in {0,5,10,15,20,25,30,...,360}{% 
\filldraw [black]  (\i:3cm) circle (0.4pt);}
\end{tikzpicture}
\end{document}

enter image description here

EDIT

Circle centre defined at coord (0,0) and given the name {a}

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node (0,0){a};
\foreach \i in {0,5,10,15,20,25,30,...,360}{% 
\filldraw [red]  (\i:3cm) circle (0.4pt);}
\end{tikzpicture}
\end{document}

To reduce the number of dots in the circle simply reduce the number of the angles to 45--90--360 as below

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node (0,0){a};
\foreach \i in {0,45,90,...,360}{% 
\filldraw [blue]  (\i:3cm) circle (1pt);}
\end{tikzpicture}
\end{document}
|improve this answer|||||
  • i) It suffices to write {0,5,...,355}. ii) How do you control the number of points as required by the asker? – Marian G. Feb 17 at 11:29
  • Thank you. Just one last thing: what should I do if I want to define the center of the circle? – FlyBob Feb 17 at 11:33
  • @FlyBob please see edit – js bibra Feb 17 at 12:58
  • @MarianG. please reduce the angular gaps as shown in the edit above to reduce the number of dots in the circle – js bibra Feb 17 at 13:04
4

Here is my proposition (with comments):

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
  \coordinate (c) at (12,3);  % center of circle
  \def\radius{6cm}            % radius of circle
  \def\nbpts{400}             % nb of points
  \def\radpt{.5pt}            % radius of points
  \colorlet{point color}{red} % color of points

  \foreach \numpt in {1,...,\nbpts}{
    \fill[point color] (c) ++ (360/\nbpts*\numpt:\radius) circle(\radpt);
  }
\end{tikzpicture}
\end{document}

enter image description here

|improve this answer|||||

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.