3

I am trying to draw the below:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[decoration={markings,
mark=at position 0.5cm with {\arrow[line width=1pt]{>}},
mark=at position 2cm with {\arrow[line width=1pt]{>}},
mark=at position 7.85cm with {\arrow[line width=1pt]{>}},
mark=at position 9cm with {\arrow[line width=1pt]{>}}
}
]
% The axes
\draw[help lines,->] (-3,0) -- (3,0) coordinate (xaxis);
\draw[help lines,->] (0,-1) -- (0,3) coordinate (yaxis);

% The path
\path[draw,line width=0.8pt,postaction=decorate] (1,0) node[below] {$\varepsilon$} -- (2,0) node[below] {$r$} arc (0:180:2) -- (-1,0) arc (180:0:1);

% The labels
\node[below] at (xaxis) {$x$};
\node[left] at (yaxis) {$y$};
\node[below left] {$O$};
\node at (0.5,1.2) {$C_{\varepsilon}$};
\node at (1.5,1.8) {$C_{r}$};
\end{tikzpicture}

\end{document}

Except with only half of the half disc, in other words exactly this path but with half the area, slicing the half after the imaginary axis. I can't seem to get the arguments of \path to change without destroying the shape. Sorry if this is very basic, I am new to TiKz.

  • try changing the path to \path[draw,line width=0.8pt,postaction=decorate] (1,0) node[below] {$\varepsilon$} -- (2,0) node[below] {$r$} arc (0:90:2) -- (0,1) arc (90:0:1); – AJN Apr 27 '16 at 6:57
  • what do you mean by after the imaginary axis? To delete the section to the left or to the right? – AJN Apr 27 '16 at 7:01
  • Delete the section to the left-sorry – qbert Apr 27 '16 at 13:31
6

The arc is a full semi circle since you are drawing from 0deg to 180deg (0:180:2 i.e., 0deg to 180deg with radius 2). To make it a quarter circle, draw it from 0 deg to 90 degree (0:90:2 i.e., 0deg to 90deg with radius 2).

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

    \begin{tikzpicture}[decoration={markings,
        mark=at position 0.5cm with {\arrow[line width=1pt]{>}},
        mark=at position 2cm with {\arrow[line width=1pt]{>}},
        mark=at position 7.85cm with {\arrow[line width=1pt]{>}},
        mark=at position 9cm with {\arrow[line width=1pt]{>}}
    }
    ]
    % The axes
    \draw[help lines,->] (-3,0) -- (3,0) coordinate (xaxis);
    \draw[help lines,->] (0,-1) -- (0,3) coordinate (yaxis);

changed lines

    % The path
    \path[draw,line width=0.8pt,postaction=decorate]
         (1,0) node[below] {$\varepsilon$} --
         (2,0) node[below] {$r$}
         arc (0:90:2) --
         (0,1) arc (90:0:1);

rest is unchanged

    % The labels
    \node[below] at (xaxis) {$x$};
    \node[left] at (yaxis) {$y$};
    \node[below left] {$O$};
    \node at (0.5,1.2) {$C_{\varepsilon}$};
    \node at (1.5,1.8) {$C_{r}$};
    \end{tikzpicture}

\end{document}

quarter circle

or alternatively

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

    \begin{tikzpicture}[decoration={markings,
        mark=at position 0.5cm with {\arrow[line width=1pt]{>}},
        mark=at position 2.8cm with {\arrow[line width=1pt]{>}},
        mark=at position 4.75cm with {\arrow[line width=1pt]{>}},
        mark=at position 5.8cm with {\arrow[line width=1pt]{>}}
    }
    ]
    % The axes
    \draw[help lines,->] (-3,0) -- (1,0) coordinate (xaxis);
    \draw[help lines,->] (0,-1) -- (0,3) coordinate (yaxis);

    % The path
    \path[draw,line width=0.8pt,postaction=decorate]
    (0,1) node[right] {$\varepsilon$} --
    (0,2) node[right] {$r$}
    arc (90:180:2) --
    (-1,0)
    arc (180:90:1);
    \end{tikzpicture}

\end{document}

left half plane

  • ahhhhh the first argument in parentheses is also degrees, this is what was tripping me up. – qbert Apr 27 '16 at 19:45
3

Or maybe you want to get

enter image description here

Code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}


\begin{tikzpicture}[decoration={markings,
mark=at position 0.5cm with {\arrow[line width=1pt]{>}},
mark=at position 2cm with {\arrow[line width=1pt]{>}},
mark=at position 4.75cm with {\arrow[line width=1pt]{>}},% <- changed
mark=at position 6cm with {\arrow[line width=1pt]{>}}% <-changed
}
]
% The axes
\draw[help lines,->] (-3,0) -- (3,0) coordinate (xaxis);
\draw[help lines,->] (0,-1) -- (0,3) coordinate (yaxis);

% The path
\newcommand\qangle{45}
\path[draw,line width=0.8pt,postaction=decorate] 
  (\qangle:1)coordinate(e)
  -- ([turn]0:1)coordinate(r)
  arc (\qangle:{\qangle+90}:2)coordinate[midway](Cr)
  -- ([turn]90:1) 
  arc ({\qangle+90}:\qangle:1)coordinate[midway](Ce)
;

% The labels
\node[below] at (xaxis) {$x$};
\node[left] at (yaxis) {$y$};
\node[below left] {$O$};
\node[below right]at(e){$\varepsilon$};
\node[below right]at(r) {$r$};
\node[above right]at(Cr){$C_{r}$};
\node[above right]at(Ce){$C_{\varepsilon}$};
\end{tikzpicture}
\end{document}

It is also possible to use another value for \qangle like 0 or 90.

With \newcommand\qangle{0} and \node[below]at(e){$\varepsilon$};\node[below]at(r) {$r$}; you get

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.