7

Suppose I have an infinite unbounded set of complex numbers, for example all the numbers outside the unit circle. Is there some good way to visualize that set using LaTeX with some drawing library?

  • 1
    Welcome to TeX.SX! Can you add a sketch of what you had in mind? Can be photo of a pencil drawing for that matter. (As you have less than 10 reputation points you can't really add photos to the post, but you can add it as any other user, via the button on the toolbar, and then just remove the ! in the markdown code for the image.) – Torbjørn T. Sep 11 '15 at 16:31

1 Answers1

11

A common practice is to use some kind of filling for the region, either in the form of shading or some type of pattern.

One option using pgfplots:

enter image description here

The code:

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{shadings}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
x=1cm,
y=1cm,
axis lines=middle,
axis background/.style={
  shade,
  inner color=blue!18,
  outer color=blue!2,
},
xmin=-4,
xmax=4,
ymin=-4,
ymax=4,
xtick={-3,...,3},
ytick={-3,...,3},
axis on top  
]
\addplot[no marks] coordinates {(0,0)};
\draw[fill=white,dashed] (axis cs:0,0) circle [radius=1cm];
\end{axis}
\end{tikzpicture}

\end{document}

And a "pure" TikZ version:

enter image description here

The code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadings}

\begin{document}

\begin{tikzpicture}
\fill[shade,inner color=blue!18,outer color=blue!2]
  (-4,-4) rectangle (4,4);
\draw[fill=white,dashed] (0,0) circle [radius=1cm];
\draw[-latex]
  (-4,0) -- (4,0);
\draw[-latex]
  (0,-4) -- (0,4);
\foreach \Valor in {-3,-2,-1,1,2,3}
{
  \draw ([yshift=1.5pt]\Valor,0) -- ([yshift=-1.5pt]\Valor,0) node[below,font=\footnotesize] {$\Valor$}; 
  \draw ([xshift=-1.5pt]0,\Valor) -- ([xshift=1.5pt]0,\Valor) node[left=3pt,font=\footnotesize] {$\Valor$}; 
}
\end{tikzpicture}

\end{document}

If you opt for using patterns, here's some example in both pgfplots and TikZ versions (but I'd suggest using the previous approach):

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{patterns}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
x=1cm,
y=1cm,
axis lines=middle,
axis background/.style={
  opacity=0.5,
  pattern=north west lines
},
xmin=-4,
xmax=4,
ymin=-4,
ymax=4,
xtick={-3,...,3},
ytick={-3,...,3},
axis on top  
]
\addplot[no marks] coordinates {(0,0)};
\draw[fill=white,dashed] (axis cs:0,0) circle [radius=1cm];
\end{axis}
\end{tikzpicture}\par\bigskip

\begin{tikzpicture}
\fill[pattern=north west lines,opacity=0.5]
  (-4,-4) rectangle (4,4);
\draw[fill=white,dashed] (0,0) circle [radius=1cm];
\draw[-latex]
  (-4,0) -- (4,0);
\draw[-latex]
  (0,-4) -- (0,4);
\foreach \Valor in {-3,-2,-1,1,2,3}
{
  \draw ([yshift=1.5pt]\Valor,0) -- ([yshift=-1.5pt]\Valor,0) node[below,font=\footnotesize] {$\Valor$}; 
  \draw ([xshift=-1.5pt]0,\Valor) -- ([xshift=1.5pt]0,\Valor) node[left=3pt,font=\footnotesize] {$\Valor$}; 
}
\end{tikzpicture}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128