2

This question already has an answer here:

I'm trying to make a Sankey diagram. I know it's possible with Tikz picture but I don't get the hang of it. I'm trying to make something like this: Diesel ICE losses Is there anyone who has experience with this package?

marked as duplicate by Raaja, Stefan Pinnow, Dr. Manuel Kuehner, siracusa, Kurt May 24 at 7:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 6
    We know that you are not able to draw this completely, but could you please provide all what you have tried? – user156344 May 23 at 13:46
  • First I started looking at some other questions e.g : tex.stackexchange.com/questions/40159/…. But I have no clue on how to start with this. Is there a pdf that explains it step by step? – Gaetaan A May 23 at 13:49
  • 3
    What we are asking about is an example code. At least you should know we do not want to draw everything from scratch. – user156344 May 23 at 13:49
  • Maybe I asked it the wrong way, my english is not that good. I didn't mean to ask drawing it yourself from scratch. What I meant to ask was, is there any pdf that explains this step by step? Because when looking at other examples the code doesn't make sense to me at all. I started using Latex a few weeks ago.. But to answer your question, no I don't have an example code or at least not somethin that I tried – Gaetaan A May 23 at 13:57
  • 1
    I'm voting to close this question as off-topic because this is a just-do-it-for-me question. – Raaja May 24 at 6:34
7

It is not easy to understand the accepted answer in your reference question, however, with some simple calculations we can draw it quite directly as follows.

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw[{Triangle Cap[reversed]}-,line width=1cm] (0,0) -- (1.5,0);
\draw[-{Triangle[width=.35cm*1.5,length=.35cm]},line width=.35cm] (1.5,.5) -- ++ (0,-2);
\draw[-{Triangle[width=.3cm*1.5,length=.3cm]},line width=.3cm] (2.5,.5) -- ++ (0,-2);
\draw[-{Triangle[width=.14cm*1.5,length=.14cm]},line width=.14cm] (3.5,.5) -- ++ (0,-2);
\draw[-{Triangle[width=.21cm*1.5,length=.21cm]},line width=.21cm] (3.5,.395) -- ++ (2,0);
\draw[line width=.65cm] (1.5,.175) -- (2.5,.175);
\draw[line width=.35cm] (2.5,.325) -- (3.5,.325);
\end{tikzpicture}
\end{document}

enter image description here

Adding the text, changing the color, and rescaling the picture so that it fits your document are what you have to do now. Hope you can do it!

  • Thanks a lot! What does this part mean '(1.5,.5) -- ++ (0,-2);' – Gaetaan A May 23 at 14:54
  • @GaetaanA I can write (1.5,.5) -- (1.5,-1.5), they are the same. Basically ++ helps you to "shift" coordinates. – user156344 May 23 at 14:56
7

Even though I only have claws my handclaw writing is more readable than yours, I think.

\documentclass[tikz,border=3.14mm]{standalone}
\newcounter{ahead}
\begin{document}
\begin{tikzpicture}[ahead/.style={/utils/exec=\stepcounter{ahead},
insert path={ -- ++ (0,#1/2) -- ++(#1,-#1) coordinate(ahead-\number\value{ahead}) --
++ (-#1,-#1) -- ++(0,#1/2) }},nodes={align=center}]
 \draw (0,0) coordinate(start) -- ++(0.75,0.75) -- ++ (-0.75,0.75) 
 node[below left]{100\%\\ Diesel}
 -- ++(10,0) [ahead=1] -| ++(-3,-3) coordinate(aux)  [rotate=-90] 
 (aux)[ahead=0.6,rounded corners=4pt] |-++(-2.5,0) [sharp corners] 
 |- ++(2,-1.5) [ahead=0.8,rounded corners=4pt]
 |-++(-2,0) [sharp corners]  |- ++(2,-1.5) [ahead=0.8,rounded corners=8pt] -| (start);
 \path (ahead-1) node[right] {Tank in total\\ 21\%}
 (ahead-2) node[below right] {unreadable\\ xx\%}
 (ahead-3) node[below] {unreadable\\ xx\%}
 (ahead-4) node[below] {unreadable\\ xx\%};
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    As far as I know, the width of the arrows must (or should) be proportional to its value, i.e. 14% arrow must be thinner than 35% arrow. – user156344 May 23 at 14:17
  • @JouleV Thanks! Yes, you can adjust this with the argument of the ahead, which precisely takes one argument that controls its width. More precisely, you can adjust this if you can read the numbers on the screen shot, which I can't. – marmot May 23 at 14:22
  • Thanks a lot! Yes my writing is unreadable haha, anyway thanks. i'll try to adjust the width and color myself now :) what is says is 'exhaust loss, cooling loss, mechanical & radiation loss' – Gaetaan A May 23 at 14:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.