[Tex/LaTex] Tikz pattern fill

patterntikz-pgf

I am using tikz for the first time and I don't know how to make this image. I can make the outline but not the patterned fill for the partial rectangle. What I want is:
what I want
What I can make is:
what I get
Here is my code for the tikz part:

\begin{tikzpicture}
\draw (-2,-0.535) -- (-2,4);
\draw (2,-0.535) -- (2,4);
\draw [dashed] (2,-4) -- (2,-0.535);
\draw [dashed] (-2,-4) -- (-2,-0.535);
\draw (-4,-4) -- (4,-4) arc(0:180:4) -- cycle;
\end{tikzpicture}

Best Answer

Here is a possible way.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{patterns.meta}
\begin{document}
\begin{tikzpicture}[scale=4,dot/.style={in front of path,
    circle,draw,fill=white,inner sep=2pt},
    m/.style={text height=1.2em,text depth=0.25ex}]
\draw [dashed] (1/2,0) node[m,below]{$\frac{1}{2}$} -- (60:1) 
(-1/2,0) node[m,below]{$-\frac{1}{2}$} -- (120:1);
\draw (1,0) node[m,below]{$1$}   
    arc[start angle=0,end angle=180,radius=1]
    node[m,below]{$-1$}  -- cycle;
\draw[pattern={Lines[angle=-45,distance=4pt]}] 
 (-1/2,2) -- (120:1) node[dot,label=above left:{$\rho^2$}]{}
 arc[start angle=120,end angle=60,radius=1]
 node[dot,pos=0.5,label=below:{$\mathrm{i}$}]{}
 node[dot,label=above right:{$\rho=\mathrm{e}^{2\pi\mathrm{i}/6}$}]{}
 -- (1/2,2);
\end{tikzpicture}
\end{document}

enter image description here

I switched to polar coordinates and use a scale factor to be able to use "natural" coordinates for \rho.

If you use an older versions of TikZ, i.e. before patterns.meta was added, use

 \usetikzlibrary{patterns}

and pattern=north east lines.

One can also use \clip to clip the relevant region.