[Tex/LaTex] Figure of a map with TikZ

tikz-pgf

This code creates two sets, call them A and B, in the complex plane:

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}
\begin{tikzpicture}
\draw (1,0) arc (0:360:1);
\fill [pattern=north east lines] (1,0) arc (0:360:1);
\end{tikzpicture}

\begin{tikzpicture}
\draw (1,1) -- (-1,1) -- (-1,-1) -- (1,-1) -- (1,1);
\fill [pattern=north east lines] (1,1) -- (-1,1) -- (-1,-1) -- (1,-1);
\end{tikzpicture}
\end{document}

Now imagine that I have a map f which maps A to B and I want to show this in a figure: So is should look like: Right to A there is an arrow with a f above. One step further on the right we then have B.

How can I realize this with TikZ?
Thank you!

Best Answer

Like this:

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{patterns,positioning}

\begin{document}
\begin{tikzpicture}[
set/.style={draw, pattern=north east lines}
                    ]
\node (a) [set,circle, minimum size=10mm] {};
\node (b) [set,minimum size=10mm,right=of a] {};
\draw[->, shorten >=1mm, shorten <=1mm]   (a) -- node[above] {$f$}    (b);
\end{tikzpicture}
\end{document}

enter image description here