6

I'm looking to use Tikz or something similar to create something like this: enter image description here except with the area of the section ABD shaded a different color. I've looked up Tikz manuals, and I could only find out how to shade sectors of a circle, not "chunks", like in this example.

I also could not figure out how to make the axes or the labels in Tikz, so if your solution could also provide that detail, that would be great. Thank you in advance for your help!

So far, I have

\begin{tikzpicture}
    \draw (0,0) arc (180:0:1cm);
    \draw (0,0) -- (2cm,0);
    \draw (0.5cm,0) -- (0.5cm, 0.866cm);
    \draw [dashed] (1cm,0) -- (0.5cm, 0.866cm);
\end{tikzpicture}
  • what you try so far? do you manage to draw image without shading? – Zarko Jul 22 '18 at 22:49
10
\documentclass[tikz, margin=3mm]{standalone}

\begin{document}
\begin{tikzpicture}[
circ/.style={circle, draw, solid, fill=white, inner sep=0.75pt,
             label=#1,
             node contents={}
             },
every label/.append style = {inner sep=2pt, font=\footnotesize}
                    ]
% shaded area
\fill[gray!30]  (0,0) arc (180:120:1cm) |- cycle;
% axis
\draw[->]   (-0.5,0) -- + (3.5,0) node[below left] {$x$};
\draw[->]   (0,-0.5) -- + (0,2.5) node[below left] {$y$};
% rest of image
\draw (0,0) node[circ=above left:$B$] arc (180:0:1) node[circ={}];
%
\draw[densely dashed]   (60:1) -- (0:1.0) node[circ=below:$\frac{1}{2}$];
\draw                   (60:1) node[circ=$A$] -- (0:0.5) node[circ=below:$D$];
\end{tikzpicture}
\end{document}

gives:

enter image description here

  • Is there a comma missing after "node contents = {}"? I tried your code exactly, and it gave several problems, and after messing around, it seems the comma helps. – D.R Jul 24 '18 at 2:53
  • @D.R, you are right. also the next style definition is on wrong place. now is all corrected. – Zarko Jul 24 '18 at 6:37

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.