0

Does anyone has an idea how I can draw this attached figure?

wanted-output

migrated from stackoverflow.com May 1 '14 at 19:26

This question came from our site for professional and enthusiast programmers.

7

The picture is just a few simple things used multiple times. To simplify it I created commands for the men and the circles, to make the placement cleaner and to make it easier if these shapes need to be changed.

The men are created with the following code

\def\man#1;{%
    \begin{scope}[shift={#1}]
        \fill [rounded corners=1.5] (0,0.4) -- (0,0.8) -- (0.4,0.8) -- (0.4,0.4) --
            (0.325,0.4) -- (0.325,0.7) -- (0.3,0.7) -- (0.3,0) -- (0.225,0) --
            (0.225,0.4) -- (0.175,0.4) -- (0.175,0) -- (0.1,0) -- (0.1,0.7) --
            (0.075,0.7) -- (0.075,0.4) -- cycle;
        \fill (0.2,0.9) circle (0.1);
    \end{scope}}

Which is invoked by \man(x,y);

The circles are created with

\def\shadecircle(#1)(#2);{%
    \draw [thick] (#1) circle (#2);
    \draw [thick,draw opacity=0.1] (#1) ++(0,-0.1) circle (#2);}

and invoked by \shadecircle(x,y)(r);

The labels in circles are just nodes placed with \draw (x,y) node {label};, and the arrows are done with

\draw [very thick,->] (startx,starty) node [label position] {label} -- (endx,endy);

Everything is placed with absolute coordinates.

The complete code is as follows:

\documentclass{article}

\usepackage{tikz}

\def\man#1;{%
    \begin{scope}[shift={#1}]
        \fill [rounded corners=1.5] (0,0.4) -- (0,0.8) -- (0.4,0.8) -- (0.4,0.4) --
            (0.325,0.4) -- (0.325,0.7) -- (0.3,0.7) -- (0.3,0) -- (0.225,0) --
            (0.225,0.4) -- (0.175,0.4) -- (0.175,0) -- (0.1,0) -- (0.1,0.7) --
            (0.075,0.7) -- (0.075,0.4) -- cycle;
        \fill (0.2,0.9) circle (0.1);
    \end{scope}}
\def\shadecircle(#1)(#2);{%
    \draw [thick] (#1) circle (#2);
    \draw [thick,draw opacity=0.1] (#1) ++(0,-0.1) circle (#2);}

\begin{document}

\begin{tikzpicture}

\draw [very thick] (0,0) rectangle (11,11);

\shadecircle(6,7.3)(2.8);
\shadecircle(3.2,7.5)(2.3);
\shadecircle(3.8,4)(3.5);

\draw (6,9.5) node {\textbf{List 1}};
\draw (2.7,9.1) node {\textbf{List 2}};
\draw (3.8,1.2) node {\textbf{List 3}};

\man(1.5,7.2);

\man(2.3,5.8);

\man(4,7.7);

\man(3.7,6);
\man(4.4,6.1);

\man(6,8.1);
\man(7,7.5);

\man(5.2,5);
\man(5.8,4.8);

\man(1.5,3.5);
\man(2.2,2);
\man(3.1,3.2);
\man(3.8,2.3);
\man(4.5,3.4);
\man(6,3.2);

\man(9.4,5.6);
\man(8.4,3.6);
\man(8.9,2.6);
\man(8.1,2);
\man(9.7,2.3);

\draw [very thick,->] (-0.5,6.5) node [left] {\(\mathbf{Y_{001}}\)} -- (2,6.5);
\draw [very thick,->] (-0.5,9.8) node [left] {\(\mathbf{Y_{010}}\)} -- (1.4,8.2);
\draw [very thick,->] (-0.5,4.7) node [left] {\(\mathbf{Y_{111}}\)} -- (4.2,5.9);
\draw [very thick,->] (1.5,-0.5) node [below] {\(\mathbf{Y_{001}}\)} -- (3.5,2.4);
\draw [very thick,->] (4,11.5) node [above] {\(\mathbf{Y_{110}}\)} -- (4,8.8);
\draw [very thick,->] (8,11.5) node [above] {\(\mathbf{Y_{100}}\)} -- (7,9.1);
\draw [very thick,->] (11.5,5.2) node [right] {\(\mathbf{Y_{101}}\)} -- (6.6,5.2);
\draw [very thick,->] (11.5,3.9) node [right] {\(\mathbf{Y_{000}=\,}\)\textbf?} -- (9.8,3.9);

\end{tikzpicture}

\end{document}

enter image description here


The code should be quite easy to play with if you're not satisfied with the result. To change the appearance of the men, for example, just change the definition of \man. To use an external image you could use the code

\def\man#1;{\draw #1 node {\includegraphics[width=0.5cm]{image}};}

If you're really ambitious you could probably use this to make the shadows under the circles blurry.

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.