27

I am trying to draw some kind of person silhouette using tikz, similar to the following image:

enter image description here

I tried a few things like using \draw with ..control, but I find it very difficult to position the intermediate points in such a way that the curve does not have sudden bents or sharp corners. I also tired using the arc command of \draw but that did not work very well either. The best that I have come up with was using two circles:

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.geometric,positioning,calc}

\begin{document}
\pgfkeyssetvalue{/cfr/soul base dimension}{10pt}
\begin{tikzpicture}

\coordinate (head-center);
\coordinate[below=1cm of head-center] (torso-center);

\draw (torso-center) circle [x radius=1.5cm, y radius=1cm];
\draw[fill=white] (head-center) circle [radius=1cm,fill=white];

\end{tikzpicture}
\end{document}

What I find particularly hard is computing (in my head) the control points that I have to place along the path. Especially since it seems that I must find consecutive controls points that such that the curve has the same incomming and outgoing angle or there will be a noticeable sharp corner between path segments.

23

The starting point is the head, here at (0,0), and the body a triangle with some bended lines and rounded corners. For simplicity I added some coordinates for the triangle as well.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \coordinate (head-center) at (0,0);
  \coordinate (top) at ([yshift=-2mm]head-center);
  \coordinate (left) at ([yshift=-10mm,xshift=-7mm]head-center);
  \coordinate (right) at ([yshift=-10mm,xshift=7mm]head-center);
  %%
  \draw[rounded corners=1.5mm,fill=blue!30] 
  (top) to [out=-10,in=100] 
  (right) to [bend left=15]
  (left) to [out=80,in=190]
  (top);
  \draw[fill=yellow,opacity=1] (head-center) circle (0.35);
\end{tikzpicture}
\end{document}

enter image description here

Edit

To get bended lines an easy way is to say to [bend left] instead of -- in the path. In this case the reference line is a straight line between the starting and ending coordinates. The drawn line starts 30 degrees left of the reference line and enter the target coordinate 30 degrees from left. See lines 1 and 2 below. You can change the default bending angle of 30 degrees by stating e.g. to [bend left] as in the figure above.

However, if you want different angles at the start and end of the line it is possible to assign any angles with to [out=30,in=30], where it is set to 30 degrees for both. As can be seen in line 3 below these angles are not relative the straight line as before, it is relative the unit circle. So 30 degrees point up to the left for both ends.

To get the same bend as before we need to derive the right values of the angles. As the outgoing angle of the straight line is 45 degrees (in this case) we need to add 30 degrees. The ending angle of straight line is 180+45=225 degrees, and having the line coming in from left gives 225-30. See line 4.

Then back to the silhouette figure. The bend of the lower line is just 15 degrees in each end, which is easiest done by stating to [bend left=15]. The others look better if they have different bending angles in start and end. For the left side of the triangle (the body) it set to 80 degrees at the start and 180+10 degrees at the end, that is in both ends 10 degrees from right angles.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw[->] (0,0) -- (1,1) node [above]{1};
  \draw[->,xshift=1cm] (0,0) to [bend left] (1,1) node [above]{2}; % bend 30 degree
  \draw[->,xshift=2cm] (0,0) to [out=30,in=30] (1,1) node [above]{3};
  \draw[->,xshift=3cm] (0,0) to [out=45+30,in=225-30] (1,1) node [above]{4};
\end{tikzpicture}
\end{document}

enter image description here

  • This is so far the most appealing solution, but I find it quite hard to visualize the points and angles in my head. Could you maybe add some explanations that explain how you came up with the angles? – lanoxx Nov 8 '16 at 16:40
  • And also why did you use bend left=15 for the right node and not a combination of in and out angles? – lanoxx Nov 8 '16 at 16:41
  • @lanoxx I have added some explanations above. – StefanH Nov 8 '16 at 21:24
  • So in essentially the in angle of each to-statement is the incoming angle for the next point. For example in this fragment (left) to [out=80,in=190] (top); the 190 degree in angle refers to the incoming angle at the point top, not the incoming angle at the left point. Correct? – lanoxx Nov 9 '16 at 19:08
  • 1
    @lanoxx Yes, in your example the line starts in position (left) at 80 degree direction, and ends in (top) at 190 degree incoming angle. – StefanH Nov 9 '16 at 19:20
38

A judicious selection of angles and radii gets you almost (but not quite) there:

\documentclass[tikz,border=5]{standalone}
\begin{document}
\tikz\draw[ultra thick] (-60:4) 
  arc (-60:240: 4)
  arc (120:180:10 and 8) 
  arc (180:360: 7 and 2)
  arc (  0: 60:10 and 8) -- cycle;
\end{document}

enter image description here

But as everyone else has put the head overlayed on the shoulders:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{fadings}
\tikzset{%
  Line Width/.code={%
    \pgfpointxy{#1}{0}%
    \pgfgetlastxy\tmpx\tmpy\tikzset{line width/.expanded=\tmpx}%
  },
  person/.style={
    Line Width=1/4, draw=gray, top color=white, bottom color=gray!50
  },
  highlight/.style={
    preaction={Line Width=1/4, draw=gray!50, path fading=west, fading angle=-45},
    Line Width=1/4, draw=white, , path fading=east, fading angle=-45,
}}
\begin{document}
\begin{tikzpicture}
\draw [person] (270:3) arc (90:180:7) 
  arc (180:360:7 and 2) arc (0:90:7) -- cycle;
\draw [highlight] (270:3+1/4) arc (90:180:7-1/4) 
  arc (180:360:7-1/4 and 2-1/4) arc (0:90:7-1/4) -- cycle;
\scoped{
\clip (270:3) arc (90:180:7) 
  arc (180:360:7 and 2) arc (0:90:7) -- cycle;
\fill [gray, opacity=0.25]    circle [radius=18/4];
}
\draw [person]    circle [radius=4];
\draw [highlight] circle  [radius=4-1/4];
\end{tikzpicture}
\end{document}

enter image description here

And here's one that's mostly about straight lines:

\documentclass[tikz,border=5]{standalone}
\begin{document}
\begin{tikzpicture}
\clip [preaction={fill=blue!50!cyan!50!gray!75}] circle [radius=12];
\fill [black] 
  (-3, -4) -- (-10,-8) -- (-10,-12) -- 
  (10,-12) -- ( 10,-8) -- (  3, -4) -- cycle;
\fill [gray!10] (3,-4) -- (2,-12) -- (-2,-12) -- (-3,-4) -- cycle;
\fill [red!75!black] (-1,-5) -- ( 1, -5) -- (0, -7) -- cycle;
\fill [red!75!black] ( 0,-5) -- (-1,-12) -- (1,-12) -- cycle;
\fill [white] (-2,-4) -- (-3,-4) -- (-5,-6) -- (-1,-5) -- cycle;
\fill [white] ( 2,-4) -- ( 3,-4) -- ( 5,-6) -- ( 1,-5) -- cycle;
\fill [pink!75!yellow!75!brown] 
  (-3, 0) -- (-3,-4) -- (-2,-4) -- (-1,-5) --
  ( 1,-5) -- ( 2,-4) -- ( 3,-4) -- ( 3, 0) -- cycle;
\fill [pink!75!yellow] 
  (0, 6) -- (-4, 6) -- (-4,-1) -- (-1,-3) -- 
  (1,-3) -- ( 4,-1) -- ( 4, 6) -- cycle;
\fill [black!50] 
  (-3,7) -- (-5,6) -- (-5,1) -- (-4,0) -- (-4,2) -- (-3,5) -- (1,4) -- 
  ( 3,5) -- ( 4,2) -- ( 4,0) -- ( 5,1) -- ( 5,6) -- ( 4,7) -- cycle;
\end{tikzpicture}
\end{document}

enter image description here

And with some minor alterations:

\documentclass[tikz,border=5]{standalone}
\begin{document}
\begin{tikzpicture}
\clip [preaction={fill=blue!50!cyan!50!gray!75}] circle [radius=12];
\fill [red!50!pink] 
  (-3, -4) -- (-9,-8) -- (-10,-12) -- 
  (10,-12) -- ( 9,-8) -- (  3, -4) -- cycle;
\fill [gray!10] (0,-10) -- (-1,-5) -- (-3,-5) -- (-2,-12) -- (2,-12) -- (3,-4) --
(-1,-5) -- cycle;
\fill [brown] 
  (-3,7) -- (-5,6) -- (-6,-1) -- (-5,-3) -- (-4,-4) -- (4,-4) --
  (5,-3) -- (6,-1) -- (5,6) -- (3,7) -- cycle;
\fill [pink!75!yellow!75!brown] 
  (-2, 0) -- (-2,-4) -- (-2,-4) -- (-1,-5) -- (0,-10) -- 
  (1,-5) -- ( 2,-4) -- ( 2,-4) -- ( 2, 0) -- cycle;
\fill [white] (-2,-4) -- (-3,-4) -- (-5,-6) -- (-1,-5) -- cycle;
\fill [white] ( 2,-4) -- ( 3,-4) -- ( 5,-6) -- ( 1,-5) -- cycle;
\fill [pink!75!yellow] 
  (0, 5) -- (-4, 5) -- (-4,-1) -- (-1,-3) -- 
  (1,-3) -- ( 4,-1) -- ( 4, 5) -- cycle;
\fill [brown] (-5,6) -- (-5,-2) -- (-4,2) -- (-3,5) -- (-1,4) --
  (3,5) -- (4,2) -- (5,2) -- (5,6) -- cycle;
\end{tikzpicture}
\end{document}

enter image description here

15

It's pretty easy to avoid sharp angles if you use .. controls +(<polar coordinate>) and +(<polar coordinate>) .. and make sure that the in and out angles are the same at each point. My attempt:

\documentclass[tikz, border=3pt]{standalone}
\begin{document}
\begin{tikzpicture}[thick]
  \draw (0,0) circle (.53);
  \draw (-130:.53) .. controls +(200:.5) and 
       +(-45:-.3) .. (-1,-1.6) .. controls +(-45:.3) and 
       +(45:-.3) .. (1,-1.6) .. controls +(45:.3) and 
       +(-20:.5) .. (-50:.53);
\end{tikzpicture}
\end{document}

person

15

This is not an answer to original question, but I think it's a good place to present the recently announced (09/11/2016) tikzpeople package. The author is Nils Fleischhacker and it draws very nice torsos and heads.

Just a little example:

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning}
\usepackage{tikzpeople}

\begin{document}
\begin{tikzpicture}[every node/.style={minimum width=1.5cm}]
\node[alice,label=Alice] (alice) {};
\node[bob,label=Bob, right=of alice] (bob) {};
\node[businessman, label=business man, below=of alice] (bm) {};
\node[priest,label=priest, right=of bm] (priest) {};
\end{tikzpicture}
\end{document}

enter image description here

And as Guilherme pointed, \usepackage[draft]{tikzpeople} draws outlined torsos:

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning}
\usepackage[draft]{tikzpeople}

\begin{document}
\begin{tikzpicture}[every node/.style={minimum width=1.5cm}]
\node[alice] (alice) {Alice};
\node[bob, mirrored, right=of alice] (bob) {Bob};
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    Providing the package with draft option gives a result than complies perfectly with the question! (just the outline of the head and torso. – Guilherme Zanotelli Nov 10 '16 at 10:42
  • @GuilhermeZ.Santos Thank you, I've added your suggestion. – Ignasi Nov 10 '16 at 10:53
11

The torso to me looks like a trapezium with bent sides. Using the shapes library you can define an auxiliary trapezium and draw using its anchors in two (that I thought of) ways, using plot [smooth cycle] or \draw [rounded corners], both ways have plenty of variables to set and make the drawing better looking:

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.geometric,topaths,positioning,calc}
\tikzset{
   torso/.style={inner sep=1pt, trapezium, anchor=north, 
                 minimum width=4cm, minimum height=2cm, 
                 trapezium angle=40,trapezium stretches
   },
   eye/.pic={\draw circle[y radius=4mm, x radius=6mm];\fill circle[radius=2mm];},
   blink eye/.pic={\draw (-6mm,0) ..controls ++(20:4mm) and ++(160:4mm).. (6mm,0);},
   smile/.pic={\draw (-1,0) ..controls ++(-40:0.8) and ++(220:0.8).. (1,0) ..controls ++(-80:1) and ++(260:1).. cycle;}
}

\begin{document}
\begin{tikzpicture}[every to/.style={bend left=20, looseness=0.8}]
  \begin{scope}[xshift=5cm]
    \coordinate (head-center) at (0,0);
    \coordinate[yshift=-0.5cm] (torso-center) at (head-center);
    \node[torso,font=\small,align=center] (torso) at (torso-center){with\\draw};

    \draw[rounded corners=0.4cm] (torso.top left corner) 
       to[bend left=10] (torso.top right corner) 
       to (torso.bottom right corner) 
       to (torso.bottom left corner) 
       to (torso.top left corner);
    \draw[fill=white] (head-center) circle [radius=1cm];
    \pic[scale=0.35] at ($(head-center)+(-4mm,2mm)$) {eye};
    \pic[scale=0.35] at ($(head-center)+(4mm,2mm)$) {blink eye};
    \pic[scale=0.5] at ($(torso-center)+(0,2mm)$) {smile};
  \end{scope}

  \coordinate (head-center) at (0,0);
  \coordinate[yshift=-0.5cm] (torso-center) at (head-center);
  \node[torso,font=\small,align=center] (torso) at (torso-center){with\\plot};

  \draw[red] plot [smooth cycle, tension=0.8] coordinates { 
    (torso.top left corner) (torso.top right corner)
    (torso.bottom right corner) (torso.bottom left corner)};

  \draw[fill=white] (head-center) circle [radius=1cm];
  \pic[scale=0.35] at ($(head-center)+(-4mm,2mm)$) {eye};
  \pic[scale=0.35] at ($(head-center)+(4mm,2mm)$) {blink eye};
  \pic[scale=0.5] at ($(torso-center)+(0,2mm)$) {smile};
\end{tikzpicture}
\end{document}

Comparison between the two ways drawn using the same trapezium:

compilation result

7

There is BUST IN SILHOUETTE (U+1F464) in Unicode. Using a font that has this symbol (e.g. Symbola, downloadable from here) it is as easy as

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\symbols{Symbola.ttf}
\begin{document}
{\symbols\char"1F464}
\end{document}

enter image description here

6

My torso is a little off but I couldn't resist:

enter image description here

\documentclass[border=5mm,tikz]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[scale=0.5]
  \draw(-0.8,4)--(-2.80,3.40);
  \draw(-2.80,2.19)--(-1.8,2.6)--(-1.8,0);
  \draw(2.80,2.19)--(1.8,2.6)--(1.8,0); \draw(0.8,4)--(2.80,3.40);
  \draw (0,4) ellipse [x radius=0.8,y radius=0.2];
  \draw[brown](0.6,4)--++(0,0.3);
  \draw[brown](-0.6,4)--++(0,0.3);
  \draw[brown](0,5.5) circle [radius=1.4];
  \draw[brown](-0.5,5.8) circle[radius=0.2];
  \draw[brown](0.5,5.8) circle[radius=0.2];
  \draw[fill=blue](-0.5,5.75) circle[radius=0.1];
  \draw[fill=blue](0.5,5.75) circle[radius=0.1];
  \draw[red](-0.5,5.2) to [out=-85, in=45] (0.5,5.2);
  \draw(0,6.8)--++(60:3mm);
  \draw(0.1,6.8)--++(60:3mm);
  \draw(-0.1,6.8)--++(60:3mm);
  \draw (0,0) ellipse [x radius=1.8,y radius=0.2];
  \draw[fill=white](-2.8,2.8)ellipse[x radius=0.6,y radius=0.15,rotate=90,fill=white];
  \draw[fill=white](2.8,2.8) ellipse[x radius=0.6, y radius=0.15,rotate=-90];
\end{tikzpicture}

\end{document}

[This drawing started it's life as part of a topology tutorial sheet: determine the standard form of the surface given by the t-shirt.]

5

I have found some good inspiration for my task by looking at this answer by Mark Wibrow.

I have adjusted my solution a little to create a better separation of the coordinates and the actual path, this way the positioning depends only on head-center which in turn can easily be made relative to some other node:

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}    
\begin{tikzpicture}

  \coordinate (head-center);
  \coordinate[below left=1.4cm and 1.5cm of head-center] (torso-left);
  \coordinate[below right=1.4cm and 1.5cm of head-center] (torso-right);
  \coordinate[below=2cm of head-center] (torso-bottom);

  \draw (head-center) 
    .. controls ++(0:-0.3) and ++(90: 0.9) .. (torso-left)
    .. controls ++(90:-0.6) and ++(0:-1) .. (torso-bottom)
    .. controls ++(0: 1) and ++(90:-0.6) .. (torso-right)
    .. controls ++(90:0.9) and ++(0:0.3) .. cycle;

  \draw[fill=white] (head-center) circle [radius=1cm,fill=white];

\end{tikzpicture}
\end{document}

The coordinates are in polar-coordinate format and the clue is to use the same angle for two successive coordinates and negate the sign of the length.

Its still not exactly like the image I posted so I guess I still need to fiddle a little with it.

Person Silhouette Black and White

  • My appologies, I have fixed it. – lanoxx Nov 8 '16 at 16:53
3

Since OP showed interest in alternatives to \draw in a comment to his post, here's how to draw a person (or some other common motive/icon) using Font Awesome:

  1. Search for your image/icon on Font Awesome Icons.
  2. Download the svg icon from their GitHub repo (e.g. click on user.svg > Raw and save the svg code locally where your tex file is located).
  3. Include the saved svg file in LaTeX using the \includesvg command from the svg package.
  4. Compile the tex file using the --shell-escape option (e.g. pdflatex --shell-escape test.tex). Note that you also need inkscape in your path (Source).

Here's an example for the user.svg icon:

\documentclass{article}
\usepackage{svg}
\usepackage{amsmath}

\begin{document}

Here is the svg image:

\includesvg[width=3em]{user}

\end{document}

And the output:

enter image description here

  • 3
    Or just: \documentclass{article}\usepackage{fontawesome}\usepackage{graphicx}\begin{document}\resizebox{3cm}{!}{\faUser}\end{document} – Ignasi Nov 9 '16 at 18:06
  • Cool, I didn't know there was a package for that. – edo Nov 9 '16 at 18:15

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.