1

I would like to draw this figure but I have no idea how to place the text which goes below each normal distribution and the main text at the center "six". I suppose this has to be done using tikz, but... isn't there any other package to draw this figure? Thanks in advance! enter image description here

1 Answers1

5
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{positioning,arrows.meta} % 
\usetikzlibrary{shadows.blur}
\begin{document}
\tikzset{shadowcirc/.style={circle,draw,blur shadow,minimum width=0.6cm},
Lbox/.style={draw,minimum width=0.6cm,minimum height=0.7cm,path picture={\draw (path picture bounding box.south west)
to[out=45,in=260] ++(0.1,0.1) -- (path picture bounding box.north);
\draw (path picture bounding box.south east)
to[out=135,in=310] ++(-0.1,0.1) -- (path picture bounding box.north);}}}
\begin{tikzpicture}
\begin{scope}[font=\tiny\sffamily]
\node[shadowcirc,fill=yellow!80!gray!30] (L){I};
\xdef\LastNode{L}
\foreach \ColA/\ColB [count=\Z] in
{cyan!30/blue,yellow!80!gray!30/black,yellow!80!gray!30/black,cyan!30/blue}
{\foreach \X [count=\Y] in {beg,mid,end}
{\node[right=0.5cm of \LastNode,shadowcirc,fill=\ColA] (node-\Z-\Y) {\X};
\draw[thick,-latex] (\LastNode) -- (node-\Z-\Y);
\draw[thick,-latex,\ColB] (node-\Z-\Y) to[out=120,in=60,looseness=7] (node-\Z-\Y);
\node[below=0.8cm of node-\Z-\Y,Lbox,fill=\ColA] (node-\Z-\Y-low){};
\draw[dashed,-{Latex[open]}] (node-\Z-\Y)-- (node-\Z-\Y-low);
\xdef\LastNode{node-\Z-\Y}
} }
\node[right=0.5cm of \LastNode,shadowcirc,fill=yellow!80!gray!30] (E) {E};
\draw[thick,-latex] (\LastNode) -- (E);
\end{scope}
\begin{scope}[font=\sffamily]
\node[below=0.3cm of node-1-2-low] (s1) {/s/};
\node[below=0.3cm of node-2-2-low] (ih) {/ih/};
\node[below=0.3cm of node-3-2-low] (k) {/k/};
\node[below=0.3cm of node-4-2-low] (s2) {/s/};
\node[below=0.6cm of node-2-3-low] (six) {"six"};
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

ADDENDUM: How can one explain this code? This is somewhat hard. But let me try. When I saw this chain of nodes, the immediate thought might be to use the chain library (section 46 of the pgfmanual), but then it is also clear that there is a certain pattern which cries for a \foreach loop which makes the chain unnecessary. Apart from the two outer nodes, the picture consists of a repetition of 3 nodes in different colors. So all I did was to write this into two nested \foreach loops. As for the lower nodes, there are may options, and maybe the one I chose is not the most natural one, pics might be more natural. But this would add another element to the story, which makes it harder to understand.

How could you do such things on your own? One way is to start a google picture search, possibly with site:tex.stackexchange.com in it, which has some of the key words like circle node, chain, shadow etc., then look at a picture code that appears to be promising and start modifying it until you are happy with the result. And if you have problems on the way, you can still ask here, but then the question would be received better since you have an MWE.

  • Hello marmot. Thanks again for the answer. However, I would like to have a short explanation since I may need to plot figure like this in the future and I wouldn't like to be constantly asking for help (I do no not want to abuse of people hospitality). Additionally, could you tell me what should I modify in the code to have a just black and white figure? It is because I can't really understand that code, and therefore I have no idea of what can be modified – little_mice May 10 '18 at 07:17
  • Thank you again marmot. I'm trying to understand step by step the code and, as you said, it is a bit hard, but not impossible. However, I would like to know how I can turn the figure just to black and white. I used \selectcolormodel{gray}, but the output is not exactly what I am looking for since I would like to have no color in each node, as well as graphics. Thanks in advance for your assistance! – little_mice May 11 '18 at 00:37
  • @little_mice One simple possibility would be to replace cyan!30, blue and yellow!80!gray!30 by some gray levels. –  May 11 '18 at 00:41
  • Thank you again marmot. I finally got the figure I was looking for. Have a nice weekend ;) – little_mice May 11 '18 at 08:07