3

I need to draw the following figure in my latex using TikZ. I did the following:

\begin{tikzpicture}
\draw (-2,0) -- (2,0);
\draw (0,-2) -- (0,2);
\draw (0,0) circle (1cm);
\draw (1,-.3) node[right] {(2,0)}; 
\draw (-1,-.3) node[left] {(-2,0)}; 

\end{tikzpicture}

But how can I shade the upper semi-circle and how can I draw the arrows in between? enter image description here

Additional Question Thank you so much for your answer. But I have one more doubt: If I use these command in my question I get the diagram right aligned and above the question. But I need it to be beside the question. And sometimes I need to define exactly where I want it to be. What should I do for this?

\question Evaluate $\displaystyle\iint_R dxdy,$ where $R$ is the shaded region in the figure.
\begin{tikzpicture}
\draw (-2,0) -- (2,0);
\draw (0,-2) -- (0,2);
\draw (0,0) circle (1cm);
\draw (1,-.3) node[right] {(2,0)}; 
\draw (-1,-.3) node[left] {(-2,0)}; 
\draw[pattern=north west lines] (-1,0) --(1,0) arc[start angle=0, end angle=180, radius=1cm];
\end{tikzpicture}

enter image description here

  • Some body give me the solution for the second question. – David Oct 12 '14 at 14:55
  • Andd suppose i have two different curves and i need to shade the area between the curve how can i do.. – David Oct 12 '14 at 14:56
  • 4
    We appreciate one question per post. If you have another question please post a new one. However, for your first question see my previous comment under my answer. As for second question, what are the two curves? Please add some (full) code. – user11232 Oct 12 '14 at 15:01
  • $y=x^2$ and $x=y^2$@HarishKumar – David Oct 12 '14 at 15:16
6

Perhaps there is a better way, but here is one brute force way. You need to load the tikzlibraries patterns and arrows.meta in your preamble.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns, arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw (-2,0) -- (2,0);
\draw (0,-2) -- (0,2);
\draw (0,0) circle (1cm);
\draw (1,-.3) node[right] {(2,0)};
\draw (-1,-.3) node[left] {(-2,0)};
\draw[pattern=north west lines] (0,-1) --(0,1) arc[start angle=90, end angle=-90, radius=1cm];
\draw[-{To[length=5pt,width=10pt]}] (0,-1) arc[start angle=-90, end angle=-45, radius=1cm];
\draw[-{To[length=5pt,width=10pt]}] (0,1)  arc[start angle=90, end angle=135, radius=1cm];

\end{tikzpicture}
\end{document}

enter image description here

  • Kindly revisit my question. I Have onemore doubt. Thank you for ur help...@darthbith – David Oct 12 '14 at 14:42
  • If i use these command it is giving this error. {I can't find file 'tikzlibraryarrows.meta.code.tex} give me a solution please. @darthbith – David Oct 12 '14 at 14:48
  • @David Two things: 1. If you have a new question, please ask a new question instead of asking your new question within this question. 2. You should use the line \usetikzlibrary{arrows.meta}. It seems like you are trying to use \usetikzlibrary{tikzlibraryarrows.meta} which is incorrect – darthbith Oct 12 '14 at 14:59
  • sure...@darthbith – David Oct 12 '14 at 15:01
4

This uses decorations and \clip.

\documentclass[tikz]{standalone}
\usetikzlibrary{patterns,decorations.markings}
\begin{document}
  \begin{tikzpicture}[arrowmark/.style 2 args={decoration={markings,mark=at position #1 with \arrow{#2}}}]
    \draw (-2,0) -- (2,0);
    \draw (0,-2) -- (0,2);
    \begin{scope}
      \clip (0,-1) rectangle (1,1);
      \draw[draw=none,pattern=north west lines,pattern color=black!50](0,0)
           circle(1cm);
    \end{scope}
    \draw[postaction={decorate},arrowmark={.375}{>},arrowmark={.875}{>}
    ]  (0,0) circle (1cm);
    \draw (1,-.3) node[right] {(2,0)};
    \draw (-1,-.3) node[left] {(-2,0)};
\end{tikzpicture}
\end{document}

enter image description here

  • Kindly revisit my question. I Have onemore doubt. Thank you for ur help...@Harish – David Oct 12 '14 at 14:43
  • @David Add baseline={(current bounding box.center)} to tikzpicture options like \begin{tikzpicture}[baseline={(current bounding box.center)}...] – user11232 Oct 12 '14 at 14:57
1

Just 4 fun with PSTricks.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
    \pswedge[fillstyle=vlines,hatchcolor=gray]{3}{-90}{90}
    \psline(0,-5)(0,5)
    \psline(-5,0)(5,0)
    \psset{arrows=->,arrowscale=2}
    \psarc(0,0){3}{-46}{135}
    \psarc(0,0){3}{134}{-45}
    \uput[-90](4,0){$(2,0)$}
    \uput[-90](-4,0){$(-2,0)$}
\end{pspicture}
\end{document}

enter image description here

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.