6

I am trying to draw this picture:

 circle intersecting a shaded non-uniform shape

I have tried a lot of things, like defining this

\newcommand\irregularcircle[2]{
    \pgfextra {\pgfmathsetmacro\len{(#1)+rand*(#2)}}
    +(0:\len pt)
    \foreach \a in {10,20,...,120}{
        \pgfextra {\pgfmathsetmacro\len{(#1)+rand*(#2)}}
        -- +(\a:\len pt)
    } -- cycle
}

But it don't give a figure that can be between the x-axis and the circle, and I don't know how to do this. Thanks.

17

One possibility is tp build up a random list and plots a smooth curve through it.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
 \pgfmathsetseed{9}
 \foreach \X in {0,...,11}
 {\ifnum\X=0
   \pgfmathsetmacro{\myradius}{2}
   \xdef\myLst{\myradius}
  \else
   \pgfmathsetmacro{\myradius}{{\myLst}[\X-1]+0.5*(rnd-0.5)}
   \xdef\myLst{\myLst,\myradius}
  \fi}
 \xdef\myLst{\myLst,2} 
 \draw[pattern=north east lines] (2,0) -- 
 plot[smooth,variable=\x,samples at={0,...,12}] 
  ([xshift=2cm]-\x*10:{{\myLst}[\x]}) -- (-60:2) arc(-60:0:2);
 \draw (120:2) arc (120:-120:2);
 \draw[-latex] (0,0) -- (5,0);
 \draw[dashed] (2,0) -- (2,-pi);
 \draw (2,0) -- ++ (-120:pi);
 \draw[latex-latex] (2,0) + (-120:2.7) arc(-120:-90:2.7) node[midway,below]{$\mu$};
 \draw[-latex] (2,0) -- ++ (-45:1) node[pos=1.2]{$z$};
\end{tikzpicture}
\end{document}

enter image description here

  • 8
    Marmot, you are a tikz god. Its the 4th question that you answer to me. Thanks a lot. I will put you in my acknowledgments of the tesis. – J.Rodriguez Mar 26 at 4:29
  • 1
    @J.Rodriguez It's my pleasure and no need to put acknowledgments. – marmot Mar 26 at 4:30
  • 4
    @marmot should be in a lot of thesis. – manooooh Mar 26 at 4:40
  • @marmot Miss \mathcal{U}_1? :-) – Sebastiano Mar 26 at 11:05
  • 1
    @Sebastiano I do not understand the comment. But please do not expect me to update my answer to add a U, there are several other things in the screen shot which I did not put in but the OP seems to be happy with it. This answer is only on the circle with some noise added on the radius. – marmot Mar 26 at 16:00

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.