In the following code, I have a diameter drawn in a circle. Along the diameter, I draw seven equally spaced nodes. The two nodes closest to the center, but not the center, are labeled B
and C
. I want to get a certain shaded pattern - shaded gray - within the circle.
Here is the procedure. First, fill the circle with a shade of gray. (I chose gray!30
.) Second, use the fill=white
option to get a white semicircle centered at B
that is above the diameter and a white semicircle centered at C
that is below the diameter. Third, draw two circles, filled-in with gray!30
of radius 1 centered at (-2,0)
and (2,0)
.
Here is my code. I get an error - there is something wrong with the command that I use to fill
.
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[fill=gray!30] (O) circle (3);
\draw[fill] (-3,0) circle (1.5pt);
\draw[fill] (-2,0) circle (1.5pt);
\draw[fill] (-1,0) circle (1.5pt);
\draw[fill] (0,0) circle (1.5pt);
\draw[fill] (1,0) circle (1.5pt);
\draw[fill] (2,0) circle (1.5pt);
\draw[fill] (3,0) circle (1.5pt);
\draw (-3,0) -- (3,0);
\node[anchor=east] (A) at (-3,0) {$A$};
\node[anchor=south west] at (-1,0) {$B$};
\node[anchor=north east] at (1,0) {$C$};
\node [anchor=west] at (3,0) {$D$};
\draw[fill=white] (-1,0) circle (2);
\draw[fill=white] (1,0) circle (2);
\draw[fill=gray!30] (-2,0) circ (1);
\draw[fill=gray!30] (2,0) circ (1);
\end{tikzpicture}
\end{document}
circ
withcircle
.path
to draw the two small circles of radius 1 - I just want the shading inside these smaller circles.circle
correctly in the last comment?