4

I wanted to shade the outside of my unit circle in my code below to get this effect:

enter image description here

Here is my code:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}

\begin{document}

\begin{figure}
\centering
 \begin{tikzpicture}[scale=1.5]
% Axes:
\draw [-latex] (-1.5,0) -- (1.5,0) node [above left]  {$\Re$};
\draw [-latex] (0,-1.5) -- (0,1.5) node [below right] {$\Im$};
\draw[dashed] (0cm,0cm) circle(1cm);
\node[solid, cross out, draw=black] at (-0.9,0) {};
\node[solid, cross out, draw=black] at (-0.5,0) {};
\node[solid, cross out, draw=black] at (0.75,0) {};
\node[solid, cross out, draw=black] at (0.3,0.3) {};
\node[solid, cross out, draw=black] at (0.3,-0.3) {};
\node[solid, cross out, draw=black] at (0.3,0) {};
\end{tikzpicture}
\caption{Pole plot for $Q(z)$ in the $Z$ plane.}
\label{polezero1}
\end{figure}

\end{document} 
Joe
  • 9,080

2 Answers2

4

Like this? I'm not sure if you want the upper half shaded or the whole outer circle, if the latter case, then remove the scope (lines 11 and 14) and clip (line 12: \path[clip] ..).

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}

\begin{document}

\begin{figure}
\centering
 \begin{tikzpicture}[scale=1.5, > = latex]
\begin{scope}
\path[clip] (-1.5,0) rectangle (1.5,1.5);
\path [inner color=red, outer color=white] (0cm,0cm) circle(1.5cm);
\end{scope}
\draw[dashed,fill=white] (0cm,0cm) circle(1cm);

% Axes:
\draw [->] (-1.5,0) -- (1.5,0) node [above left]  {$\Re$};
\draw [->] (0,-1.5) -- (0,1.5) node [below right] {$\Im$};
\node[solid, cross out, draw=black] at (-0.9,0) {};
\node[solid, cross out, draw=black] at (-0.5,0) {};
\node[solid, cross out, draw=black] at (0.75,0) {};
\node[solid, cross out, draw=black] at (0.3,0.3) {};
\node[solid, cross out, draw=black] at (0.3,-0.3) {};
\node[solid, cross out, draw=black] at (0.3,0) {};
\end{tikzpicture}
\caption{Pole plot for $Q(z)$ in the $Z$ plane.}
\label{polezero1}
\end{figure}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
4

I would avoid filling the inner circle with white by using the even odd rule to shade. This will ensure that any coloured background will show through. (Of course, if you want a white inner circle, you should not use this method!)

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}

\begin{document}
\begin{tikzpicture}
  \shade [inner color=red, outer color=white, even odd rule] circle (1.5) circle (1);
  % Axes:
  \draw [-latex] (-1.5,0) -- (1.5,0) node [above left]  {$\Re$};
  \draw [-latex] (0,-1.5) -- (0,1.5) node [below right] {$\Im$};
  \draw[dashed] (0cm,0cm) circle(1cm);
  \node[solid, cross out, draw=black] at (-0.9,0) {};
  \node[solid, cross out, draw=black] at (-0.5,0) {};
  \node[solid, cross out, draw=black] at (0.75,0) {};
  \node[solid, cross out, draw=black] at (0.3,0.3) {};
  \node[solid, cross out, draw=black] at (0.3,-0.3) {};
  \node[solid, cross out, draw=black] at (0.3,0) {};
\end{tikzpicture}
\end{document}

<code>even odd rule</code>

cfr
  • 198,882