4

I want to draw a circular disk which is partitioned with small lines on the disk and with small circular disks instead of lines in some selected places.

For example, a circular disk which is partitioned into nine parts and seven parts are shown with small lines on it and two of them are shown with small black circular disks instead of lines. How can I plot that with tikz?

I can plot a circular disk like the one below:

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\def\NumSpokes{8}
\def\InnerR{2.9}
\def\OuterR{3}
\draw (0,0) circle (\OuterR); \foreach \k in {1,...,\NumSpokes}
{%
\draw (\k*360/\NumSpokes:\InnerR) -- (\k*360/\NumSpokes:\OuterR+0.1) ; }
\end{tikzpicture}
\end{document}

But I want to add some small black circular disks on the main disk where there are small lines.

  • 1
    I didn't understand, can you show a freehand drawing so that we can better understand your problem? – AndréC Sep 9 '18 at 7:44
  • \documentclass[border=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \def\NumSpokes{8} \def\InnerR{2.9} \def\OuterR{3} \draw (0,0) circle (\OuterR); \foreach \k in {1,...,\NumSpokes}{% \draw (\k*360/\NumSpokes:\InnerR) -- (\k*360/\NumSpokes:\OuterR+0.1) ; } \end{tikzpicture} \end{document} – sara kaviani Sep 9 '18 at 7:56
  • 1
    I can draw a circle like above comment. I just want to put some little black circles in some places on the circle where there are little lines. assume that there are some sites on a circle that can be filled with some little circles – sara kaviani Sep 9 '18 at 7:59
  • 1
    please edit the question instead of answering in the comments. – AndréC Sep 9 '18 at 8:00
  • 1
    and please use the term "circular disk" instead of "circle" if this is needed somewhere to make clear what you mean. Circle will be just the line (just to help us understand) – koleygr Sep 9 '18 at 8:04
6

Do you mean this:

\documentclass[border=5pt]{standalone}
\usepackage{tikz} 
\usetikzlibrary{calc} 
\begin{document} 
\begin{tikzpicture} 
\def\NumSpokes{8} 
\def\InnerR{2.9} 
\def\OuterR{3} 
\draw (0,0) circle (\OuterR); \foreach \k in {1,...,\NumSpokes}
{% 
\draw (\k*360/\NumSpokes:\InnerR) -- (\k*360/\NumSpokes:\OuterR+0.1) ; } 
\foreach \k in {3,6,7}{%
\fill[black] (\k*360/\NumSpokes:\OuterR) circle (0.1);
}
\end{tikzpicture} 
\end{document}

enter image description here

Edit:

After last comment about distances:

\documentclass[border=5pt]{standalone}
\usepackage{tikz} 
\usetikzlibrary{calc} 
\usetikzlibrary{decorations.pathreplacing}
\begin{document} 
\begin{tikzpicture} 
\def\NumSpokes{8} 
\def\InnerR{2.9} 
\def\OuterR{3} 
\draw (0,0) circle (\OuterR); \foreach \k in {1,...,\NumSpokes}
{% 
\draw (\k*360/\NumSpokes:\InnerR) -- (\k*360/\NumSpokes:\OuterR+0.1) ; } 
\foreach \k in {3,6,7}{%
\fill[black] (\k*360/\NumSpokes:\OuterR) circle (0.1) ;
\coordinate (Cir\k) at (\k*360/\NumSpokes:\OuterR) ;
}
\draw[dashed] (3*360/\NumSpokes:\OuterR)--(6*360/\NumSpokes:\OuterR);
\draw[dashed] (3*360/\NumSpokes:\OuterR)--(7*360/\NumSpokes:\OuterR);
\draw[dashed] (6*360/\NumSpokes:\OuterR)--(7*360/\NumSpokes:\OuterR);

%distances
\draw [decorate,decoration={brace,mirror,amplitude=10pt}]
(Cir3) -- (Cir6);
\node at ({(3+6)/2*360/\NumSpokes}:1.7) {$L_1$} ;
\draw [decorate,decoration={brace,amplitude=10pt}]
(Cir3) -- (Cir7);
\node at ({(3+7)/2*360/\NumSpokes}:-0.7) {$L_2$} ;
\draw [decorate,decoration={brace,mirror,amplitude=10pt}]
(Cir6) -- (Cir7);
\node at ({(6+7)/2*360/\NumSpokes}:3.5) {$L_3$} ;
\end{tikzpicture} 
\end{document}

Output: enter image description here

Distances can be improved and also can be calculated to be automatic... But you get the point.

LAST EDIT:

\documentclass[border=5pt]{standalone}
\usepackage{tikz} 
\usetikzlibrary{calc} 
\usetikzlibrary{decorations.pathreplacing}
\begin{document} 
\begin{tikzpicture} 
\def\NumSpokes{8} 
\def\InnerR{2.9} 
\def\OuterR{3} 
\draw (0,0) circle (\OuterR); \foreach \k in {1,...,\NumSpokes}
{% 
\draw (\k*360/\NumSpokes:\InnerR) -- (\k*360/\NumSpokes:\OuterR+0.1) ; } 
\foreach \k in {3,6,7}{%
\fill[black] (\k*360/\NumSpokes:\OuterR) circle (0.1) ;
\coordinate (Cir\k) at (\k*360/\NumSpokes:\OuterR) ;
}

\draw let \p1=(Cir3)  in (\x1,3.4) -- (\x1,3.6);
\draw let \p2=(Cir6) in (\x2,3.4) -- (\x2,3.6);
\draw let \p3=(Cir7) in (\x3,3.4) -- (\x3,3.6);

\draw[dotted] let \p1=(Cir3)  in (\x1,\y1) -- (\x1,3.6);
\draw[dotted] let \p2=(Cir6) in (\x2,\y2) -- (\x2,3.6);
\draw[dotted] let \p3=(Cir7) in (\x3,\y3) -- (\x3,3.6);

\draw[dashed] let \p1=(Cir3), \p2=(Cir7)  in (\x1,3.5) -- (\x2,3.5);


%distances
\draw [decorate,decoration={brace,amplitude=10pt}]
let \p1=(Cir3), \p2=(Cir6) in (\x1,3.7)-- (\x2,3.7)node[midway,above,shift={(0,0.3)}]{$L_1$};

\draw [decorate,decoration={brace,amplitude=10pt}]
let \p1=(Cir6), \p2=(Cir7) in (\x1,3.7)-- (\x2,3.7)node[midway,above,shift={(0,0.3)}]{$L_2$};

\end{tikzpicture} 
\end{document}

enter image description here

  • Yes.that is exactly what I want! – sara kaviani Sep 9 '18 at 8:16
  • is it possible to show the distance between the first and the second black circles with for example "L1" and the distance between the second and the third black circles with "L2" by a simple "{"s with "L1" and "L2" on them above the main disk? – sara kaviani Sep 9 '18 at 8:18
  • It was hard for us to understand because you already new to draw a circle (and to use \foreach loops that means you have the level for simple graphics) and your question was just "How to draw a filled circle" – koleygr Sep 9 '18 at 8:18
  • I didn't know anything about the tikz plots when i ask my question. but untill you answer my question I found a sample and share it here – sara kaviani Sep 9 '18 at 8:20
  • @sarakaviani, see the edit – koleygr Sep 9 '18 at 8:44
5

Perhaps like that, if I understood correctly?

I used the ifthen package to do a test in the loop. For values 3 and 7, the loop builds a circle instead of a small line.

\documentclass[border=5pt]{standalone}
\usepackage{ifthen}
\usepackage{tikz} 
\usetikzlibrary{calc} 
\begin{document} 
\begin{tikzpicture} 
\def\NumSpokes{8} 
\def\InnerR{2.9} 
\def\OuterR{3} 
\draw (0,0) circle (\OuterR); 
\foreach \k in {1,...,\NumSpokes}
{\ifthenelse{\k=3}{\draw (\k*360/\NumSpokes:\OuterR)circle(2pt);   }
{\ifthenelse{\k=7}{\draw (\k*360/\NumSpokes:\OuterR)circle(2pt);   }
{\draw (\k*360/\NumSpokes:\InnerR) -- (\k*360/\NumSpokes:\OuterR+0.1) ; 
}}} 
\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.