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.

sara kaviani
  • 93
  • 1
  • 6
  • 1
    I didn't understand, can you show a freehand drawing so that we can better understand your problem? – AndréC Sep 09 '18 at 07: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 (\k360/\NumSpokes:\InnerR) -- (\k360/\NumSpokes:\OuterR+0.1) ; } \end{tikzpicture} \end{document} – sara kaviani Sep 09 '18 at 07:56
  • That's better, but it would be even better if you edit your question by adding this code! – AndréC Sep 09 '18 at 07:58
  • 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 09 '18 at 07:59
  • 1
    please edit the question instead of answering in the comments. – AndréC Sep 09 '18 at 08: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 09 '18 at 08:04

2 Answers2

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

koleygr
  • 20,105
  • Yes.that is exactly what I want! – sara kaviani Sep 09 '18 at 08: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 09 '18 at 08: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 09 '18 at 08: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 09 '18 at 08:20
  • @sarakaviani, see the edit – koleygr Sep 09 '18 at 08:44
  • @kolegr Distances are what I mean but I want the distances to be out of the circle not inside. what should I do? – sara kaviani Sep 09 '18 at 10:16
  • please ask a new clear question about that. Or edit your post with a diagram of your expectation (use a simple draw tool on the first image) – koleygr Sep 09 '18 at 10:17
  • @sarakaviani I edited the answer to what I could understand... Distances was my first edit too and this now is called horizontal distances – koleygr Sep 09 '18 at 10:48
  • Thank you for your responses. I really appreciate that but I want the "{"'s to be drawn along the circle from the first circle to the second one and from the second one to the third. – sara kaviani Sep 09 '18 at 11:10
  • A distance is a straight line... do you mean straight line or bended? Do you need something like this: https://tex.stackexchange.com/questions/44723/make-curly-braces-wrap-around-part-of-a-circle ? – koleygr Sep 09 '18 at 11:13
  • yes I want exactly something like this. I want it to be bended and to write "L1" and "L2" above them – sara kaviani Sep 09 '18 at 11:21
  • My answer is here: https://tex.stackexchange.com/a/450095/120578 (in your new question) – koleygr Sep 09 '18 at 11:27
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

AndréC
  • 24,137