I am looking for a way to do something like in the image below

  • It would be a reasonably simple diagram in tikz
    – Guido
    Oct 25, 2012 at 3:37
  • 1
    Could you describe in words what you're looking for and what specifically you're having trouble with?
    – doncherry
    Oct 25, 2012 at 3:46
  • 1
    What have you tried so far? It is much appreciated if you show your efforts so far.
    – gerrit
    Oct 25, 2012 at 7:45
  • I am just drawing in Visio and including as a picture, which is a terrible idea.
    – Pablo
    Oct 28, 2012 at 11:37
  • BTW, this image is just a sample I found on the web. Nothing to do with the article I am writing.
    – Pablo
    Oct 28, 2012 at 11:38

4 Answers 4


One option using TikZ:



\begin{tikzpicture}[line width=1pt,>=latex]
\node (a1) {Anu};
\node[below=of a1] (a2) {Ashu};
\node[below=of a2] (a3) {Jenny};
\node[below=of a3] (a4) {Cathy};

\node[right=4cm of a1] (aux1) {};
\node[below= 0.5cm of aux1] (b1) {Raaz};
\node[below=of b1] (b2) {Jonathan};
\node[below=of b2] (b3) {Fred};
\node[right=4cm of a4] (aux2) {};

\node[shape=ellipse,draw=myblue,minimum size=3cm,fit={(a1) (a4)}] {};
\node[shape=ellipse,draw=myblue,minimum size=3cm,fit={(aux1) (aux2)}] {};

\node[below=1.5cm of a4,font=\color{myblue}\Large\bfseries] {Domain};
\node[below=1.5cm of aux2,font=\color{myblue}\Large\bfseries] {Range};

\draw[->,myblue] (a1) -- (b1.170);
\draw[->,myblue] (a2) -- (b1.190);
\draw[->,myblue] (a3) -- (b2.175);
\draw[->,myblue] (a4.20) -- (b2.190);


enter image description here


Another solution if you need to adapt the size of the map. if you want to scale the picture it's preferable to avoid fit. It's possible also that you want to draw the same ellipses. In this case you can do that



\draw[ultra thick,myblue] (0,0) circle [x radius=1.5cm, y radius=5cm]
                    (6,0) circle [x radius=1.5cm, y radius=5cm];

\node[font=\color{myblue}\Large\bfseries] at (0,-6) {Domain};
\node[font=\color{myblue}\Large\bfseries] at (6,-6) {Range};  

\node (a1)  at (0,3)  {Anu};
\node (a2) at (0,1)   {Ashu};
\node (a3) at (0,-1)  {Jenny};
\node (a4) at (0,-3)  {Cathy};

\node[circle] (b1) at (6,2)  {Raaz}; 
 % I used circle to get a fine position of the arrows without a complicated code
\node[circle] (b2) at (6,0)  {Jonathan};
\node[circle] (b3) at (6,-2) {Fred};

\draw[thick,->,myblue] (a1.east) -- (b1);
\draw[thick,->,myblue] (a2.east) -- (b1);
\draw[thick,->,myblue] (a3.east) -- (b2);
\draw[thick,->,myblue] (a4.east) -- (b2);

It's possible to define some styles to get a better code. It's possible to use some variables to draw automatically some parts of the code.

Update 2

We can add some styles :




                    set name/.style={font=\color{myblue}\Large\bfseries\sf},
                    set/.style={ultra thick,myblue},
                    every node/.style={circle},
\draw[set] (0,0) circle [x radius=1.5cm, y radius=5cm]
           (\xsetpos,0) circle [x radius=1.5cm, y radius=5cm];

\node[set name] at (0,-6) {Domain};
\node[set name] at (\xsetpos,-6) {Range};  

\node (a1) at (0,3)  {Anu};
\node (a2) at (0,1)  {Ashu};
\node (a3) at (0,-1) {Jenny};
\node (a4) at (0,-3) {Cathy};

\node (b1) at (\xsetpos,2)  {Raaz};
\node (b2) at (\xsetpos,0)  {Jonathan};
\node (b3) at (\xsetpos,-2) {Fred}; 

  \draw (a1.east) -- (b1);
  \draw (a2.east) -- (b1);
  \draw (a3.east) -- (b2);
  \draw (a4.east) -- (b2); 


enter image description here

  • 1
    Don't forget the sans-serif font in question. :) Oct 25, 2012 at 9:53
  • @ガベージコレクタ The question is about drawing, the font is not a real problem here but I updated my answer. Oct 25, 2012 at 16:53

There is no need for using absolute coordinates, which make things only complicated:


\def\arraystretch{2 }
\tabular{c}    % left names
\tabular{c}    % right names
\textcolor{NavyBlue}{\bfseries Domain} & \textcolor{NavyBlue}{\bfseries Range}
 \ncline{Anu}{Raaz}    \ncline{Ashu}{Raaz}   \ncline{Jenny}{Jonathan}   \ncline{Cathy}{Jonathan}

enter image description here


Just for fun with PSTricks.

enter image description here

    % title
    % left names
    % right names
    % settings
    % left ellipse
    % right ellipse
    % arrow connections
    % left bottom label
    \uput[-90](-2.5,-3){\textcolor{NavyBlue}{\bfseries Domain}}
    % right bottom label
    \uput[-90](2.5,-3){\textcolor{NavyBlue}{\bfseries Range}}


If you are new to PSTricks, the following descriptions will get you up and running quickly with PSTricks.

  • \rput[b](0,3){FindFathersMap} will put the bottom point of the box enclosing the text to point (0,3). If you don't specify the optional reference [b], then by default the center of the box will be placed at (3,0).
  • \rnode[<ref point>]{<content>}{<nodename>} is used to enclose a non-zero dimensional object with a hypothetical box node named <nodename> where the reference point is determined by [<ref point>]. If you set [r], for example, then the reference point is at the right side of the box node.
  • we use \rput and \rnode together to move a non-zero dimensional object and enclose it with named node.

The remaining descriptions are left for my next edit.

Another method with psmatrix

enter image description here

\documentclass[preview,dvipsnames,border={9mm 0pt 7.4mm 1pt}]{standalone}

    [name=Left]&& [name=Right] \rnode[l]{Jonathan}{Jonathan}\\
    \textcolor{NavyBlue}{\bfseries Domain}&&\textcolor{NavyBlue}{\bfseries Range}
% arrow connections

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .