 Hi everyone, I'm Aristide from Metabolism of Cities and in this new video I want to teach you how to make a Sankey diagram from scratch for free, even if you don't know how to code or to visualize any type of datasets. If you don't know what a Sankey diagram is, why it is so important for the fields of circular economy, material flow analysis and urban metabolism, then I highly suggest to you to first pause this video, go watch this video instead and then come back to learn how to make a Sankey diagram yourself. So to summarize what was said in this other video, a Sankey diagram is this flow diagram that shows you how materials, energy, waste, money, in general any type of flow go from one stage to another. So how one flow goes from one node as we call them in the jargon to another node. So we call them the source nodes and then the target node. That's where it starts from and that's where it ends from and the flow itself, we just need to give it a value. So these are the three main things you need to give to any type of software or tool in order to create a Sankey diagram. You always need to indicate what is the source node, what is the end or target node and then what is the value of that flows. These are the three parameters that you need to give. Now, you might of course understand that if you want a complex Sankey diagram or a more elaborate Sankey diagram, you might have more than one of these flows. So you might have 10, 15, 30, 100 flows. In any case, you will always have to indicate where does the flow originate from, where does it end up and what is the value of that flow. That's the proportionality, you know, how big your flow is in your diagram. Once you have this, you know, you have these three elements, you can then add some nice colors, you can then add some nice icons, if you want, you can make it as fancy as you want. But these are the three elements that you will always need to make a Sankey diagram. Okay, now that you know what are the three elements to create a Sankey diagram, let's dive into it and I'll show you directly into some software's how to do it. So if you click online, you go to Google and search how to make a Sankey diagram, you'll probably find dozens and dozens of ways of how to do a Sankey diagram, how to make it for free, how to make it spade, how to make it with coding, without coding and all of that. If you want, let me just show you over here. There is, of course, if you're familiar with data visualization and data collection and all of that, you might know Tableau over here and Tableau, you just upload your datasets and then it can create data visualizations for you. Then if you are familiar with coding in Python or something like that, you have Plotli that creates Sankey diagrams for you. So you just copy this code in Jupyter or in Python directly and you get your basic diagrams like this and you can move your nodes and have the values explained over here. And if you want to make more complex diagrams, it explains you here how to make, you know, with much more flows and all of that. Then as a paid example or alternative, which is quite nice, you have eSankey here from EFU, a university in Hamburg. And then what's nice with it is that it gives you some more additional elements to this, not only how to create your Sankey diagram, but also how to make circular flow diagrams. This is the bane of most tools, is that they don't allow you to make circular flows. They only allow you to go from one node to another, but rarely to go back to another node. But also it enables you to combine Sankey diagrams and flows with LCA elements or life cycle assessment values with it. So this is a paid version though. And then the tool I always recommend, if you are new to data visualization and if you are new to material flow analysis, is Sankeymatic. There are plenty of others. There is raw tools, which is also very powerful and very beautiful. I like this one because of its simplicity. It just does Sankey diagrams and everybody can use it and it's free and it's easy to use. Now let me just show you how this works. So if you remember well, these are the Sankey diagrams. You have nodes and then you have flows. Let's try to go here where it says build a Sankey diagram directly and it shows you already a Sankey diagram. It shows you the one that they have made for you. So in this one, it tells where does your, where does one's budget comes from and where does it end up to. So let's see it. So your monthly budget is let's say 2,000 euros or dollars or something and you have a 2,025 and 2,000 comes from your wage and 25 euros or dollars come from interest in the bank. And then over here on the right, it tells you where do you spend your budget. So 5,500 of the budget goes to taxes, then some goes to housing, et cetera, et cetera, et cetera. So this is the main principle of a Sankey diagram if you remember. We have a source node. So this bar over here is a node and you can move it around. This bar over here is another node. That's the target node. And we have 2,000 going from wages to budget. And actually it's very simple. If you see it here, so if we zoom in a bit further, you will see that here we have wages, which is the target, sorry, the source node, where does it come from? Over here on the left. Then the target node over here on the right. And then the value, which is the value of the flow, which is 2,000. So 2,000 goes from here to here. And it even tells you how it works here above. Source, source node, amount or value and then target on the right. And so the syntax or how do you write this in this, let's say a small piece of software is that you have the name of the nodes, square brackets, the value of the flow and then the name of the target node. It's as easy as that. Now let's see what happens if I take out, let's say, interest over here and then you type preview again, you see that this does not exist anymore. If I wanted, I'll go back here and then I change interest to 100 preview. And you see that over here it also does some cross check. You can have this or it can tell you if all of the inputs and all of the outputs are equal the same amount or not. That is a good, let's say, cross reference if you want to make sure that your Sankey diagram is balanced. And over here we see that there is, it says that 2,100 comes in, but 2,025 goes out. So I could go here in budget and do budget. So instead of doing that, let me just copy paste directly, budget and say 75, which is the difference between the two, 75 and say that it goes to savings. If you preview it again, then you see that you have savings here and now it's balanced. You can also change the order of your nodes over here. So I want this one up top and this one down below or, you know, you change it a bit as you want. You can move it around here, what you can do if you want your diagram a bit more wide, let's say, because it's a wider report. You put here 1,000 instead of 600. You see that your diagram has stretched out and perhaps you want some more room over here and all of that. Now you could, for instance, before wages add something more. So you want, let's say, so you have salary or let's say you have job one that gives you, let's say that you are doing two jobs in order to earn your wage. So let's say 1,000 goes to wages. Now be careful, it has to be exactly the same way you wrote it. If you just write wage instead of wages, it's going to create a new node, it's going to become a mess. So be careful when you write the nodes, it has to be exactly the same spelling. So I've added job one and job two going to wages 1,000 and 1,000. If we preview, then it adds some more below. So you have more tiers, let's say, of your Sankey diagram. You can add as many as you want and then make it as complex as you want. Now there's some other stuff that you can do. For instance, colors. You can choose what is the background color. Perhaps you want something else. You want it a bit this color. I don't know why you would, but let's say you want a color. And then you can choose. There are some not color themes. So you see here it's blue, dark blue, light blue, light blue, and then different colors over here. So let's say you want something different. Or you can use a single color for them. So all of the nodes have a single color, except the ones over here. Let me just turn this out. And this one over here. So all of them have the same color and the same with the flows. Let's say you can choose what color you want for the flow. Or so you have gray flows and blue nodes to make it as consistent as possible. Then you can also choose to use the, for the flows, you can choose to use the source nodes color or the target nodes colors. That's also possible. And then you can also assign yourselves colors to each of the individual, how you call it, flows over here. I'll show you that in a second. And then you can start adding labels. So the labels here, you can take them or take them out. If you want to write a nicer text with nicer fonts and all of that, you can take it out and add it later on. You can add just the name of the node and not the values and all of that. And then you can also, in the advanced, this is the flow check, as I mentioned before. And at the very end, you export it as you want. So as an image, let's say, or as an SVG, if you are, let's say, someone that knows how to design in Illustrator or anything else, you download it as an SVG and it's a dynamic illustration that you can move things around. You can also put this online on any website, SVGs or dynamic. So you can use that in any other website in case you need that. Now, as I said, you can also choose colors, right? So over here, if I go back, you'll see that you have two colors. One is taxes. It has this color over here. So it's a node. And it tells you what is the color over here. So these are called color hex, let's say. It's a code that you use on the internet to define one specific color, let's say. So in general, when you print, you have RGB, but this is a different type of colors. And you can find whatever color you want. And just copy it here. And you'll see that the node is going to change color. So that's for a specific node. So how you do it is, after you have written this, so the source nodes, the value and the target nodes, you can then change the color of the nodes that you want. So let's say that was for taxes, let's do the same thing for housing. And let's say I want a different node. So I go back here, I take this one, and then paste it here. And you see it has another color. So this, let's say, if you want to group stuff, let's say these are construction materials, and then biomass materials, and then stuff like that. So you can group them by color. And you can either do that on the node. And over here, because it says use target node, instead of a single color for the flow. So over here, it just shows the node. That is a different color. But you can also do the flow itself. So here, as you see, is that you have the flow, so budget going to other necessities, and then it has a color. And this one has a specific color that you have specified. And so you can change the color of the nodes, or you can change the color of the flows. It's up to you. You can change different colors and make it as much as you want. Now, let me just give you another example and how to make this. So I'll take this all down. Something just to never forget, or else you're going to get frustrated with this, you can't save this, right? So you can save this text. So if you close this, then you lose all of the efforts that you have done. So what I recommend is that you copy this in a text file or any other file in order that when you come back, you just copy paste it again. And then you're where you were just before. So keep that in mind. So let me just give you another example I just built for you, which was this one, which seems a bit more, let's say, material flow or circular economy like. And what I did here, it's more ugly than the previous one is just an example. So you can understand. So let's say that this is our economy here, what we use, what we consume within our economy, the use. And we have imports that go directly to the use. And then we have extraction materials that either go directly to use or to manufacturing. In this case, I've put manufacturing. And then from use, either it goes to waste. So it's collected as waste, or it goes to stock. So let's say we consume, I don't know, we consume six, let's say tons of materials, and four of them go to building buildings. So that's not waste. And two of them go directly to waste. And then every year from stock, well, some of the buildings are demolished. So you have waste going from stock to waste collection. And then you have waste, let's say treatment. So once you have collected your waste, this is how it's treated. So you see that we've with a very simple thing, with a very simple number of lines, you can have your your Sankey diagram showing how the flows of the economies go. And the quantities you can find them on a report, for instance. And to do this very easily, I did here on Google Sheets. That's how I generally do it. You can do it in a different way. But I make three columns. The headers of the columns are, let me just make this a bit bigger. So I have three columns here. It's the from node, the to node or the target node, and then the quantity of the flow, as I mentioned before. So here I say from extraction to manufacturing, the quantity is x. It could be one, it could be three, you name it. And I do this for all of the flows that make up my system. So from extraction to manufacturing, from manufacturing to use, from use to waste collection, etc, etc. Then you have the values that you find in reports, or you modulate yourself. And then what I did over here is another line, another, sorry, column that's called Sankeymatic. And it automatically brings things from these three cells. So manufacturing, which is the from, to is the target node and then the quantity. And it creates this. So this text is a Sankeymatic text that Sankeymatic can understand. So you just copy this one, you paste it in Sankeymatic, and then you have your Sankey Diagram. Of course, it's not the right values. This is just an example. But you get it, this is how it works. So this is in a nutshell how you make a Sankey Diagram. You see, it's really not complicated. You just, at the end of the day, need to find data. But this is just the way how to structure your data in order to make your Sankey Diagram, how to make your Sankey Diagram, and then how to export it in an image for a report, or in SVG, for making it much nicer in Illustrator, let's say, or Inkscape, or include it into a website. So I hope this was helpful. If you have questions, more questions about Sankey Diagrams and how to make them, please make sure to put them down below and we'll try to answer that. So if you like this video, you might like some other videos that we have on our channel. So please have a look, and also subscribe to our channel so you don't miss any new one. Thanks a lot for watching and we'll see you in the next one. Cheers.