Another very important type of color scale is what is called a diverging color scale. So, what is a diverging color scale and why do we need it? Well, sometime it's useful to distinguish between values, quantitative values that are above or below a given threshold. Let me give you a few examples. Say that you have in a dataset information about altitude above or below the sea level. So, you still have a quantity how high or how low, but you also have a threshold, and you may want to be able to distinguish between what is above, and what is below. Or say in election data, so if you want to know the percent of votes between two candidates, is it more for a given one candidate or for the other. Again, you may want to distinguish between the two. Or say that you have information about profits in a company, and you have positive and negative profits. Again, it's quantitative data, but you want to distinguish between positive and negative, above or below a threshold, okay? So, when this piece of information is important to communicate, typically, sequential scales don't work. We need a different method. Let me give you an examples to show you how this works. Here, I'm showing on this choropleth map information about votes, elections, I think this data comes from the 2016 elections in the United States, okay? It shows the proportion, or in this particular map, what a map is the proportion for the Democratic candidate. So, the more intense is the color, the darker the color, the more votes went to the Democratic candidate or party, and the lighter it is, the more it went to the Republican candidate, okay? So, now, if you want to distinguish between regions that gave votes more to the democratic candidate is not that easy because you don't really have a threshold visually that distinguishes between the two segments above 50 percent and below 50 percent. So, now, if I redesign this map, and I use what is called a diverging color scale, what you obtain is something like this. So, now what did I do? I still use a color scale that is able to show the intensity, the proportion, but now the color scale is segmented in two parts, above 50 percent and below 50 percent, okay? Because of that, now you can very easily distinguish the blue counties from the red counties. But note, that within blue and within red, you still perceive different shades, okay? So, we have the best of the two color scales that we analyzed so far. So, we can segment using hue, but we can also communicate information about magnitude using color intensity. This is exactly what a diverging color scale is, okay? So, a color scale encodes two properties at the same time. Whether, a value is above or below a given threshold, and within these two classes, the magnitude, the range. So, what are the desired properties of diverging color scales? Well, generally speaking, the same properties that we discussed for categorical scales and for quantitative scales still hold, okay? For instance, we want the two hues to be different enough so that we can very readily distinguish between the two categories. But we also want the color intensities to change in a way that these differences are perceived as linear, as the same amount of change from one color to the other. You also have an additional property that you want to satisfy in a diverging color scale. So, since we have two classes, and since the intensity is increasing from the center to the edges, you want to make sure that the change in intensity from the center to one direction and from the center to the other direction is actually the same, okay? You don't want the two scales to be unbalanced. So, let me show you how a diverging color scale is built, and probably what I just said is going to be a little bit clearer in a moment. So, how do you actually build a diverging color scale? It's not that hard. So, we can start from building independently two quantitative color scales with the same principles that we've seen before. In this case, I just selected one that is based on red, on a red hue, and one that is based on a blue hue, okay? As you can see, both are quantitative and both are changing with the same step in terms of intensities. The only difference between the two is the hue. So now, what I can do is to flip one of them, and join them by the color in the middle that they have in common, that in this case is white. Note once again that in both sides of the scale, we go from very dark, sorry, from very dark, to very high in color intensity. So, very dark, very light. So, they converge in the middle. The same thing can be done in many different ways. So, here is an example where again, we have diverging color scales that go from green to brown reddish. Once again, from blue to red and there is one common color in the middle. The main difference between this one and the previous one is that here we don't have discrete steps is actually continues, okay? Here is another example, this is a graph that is taken that visualizes information about climate change. So, this is how the temperature changes across many years in different areas of the world, and the temperature is relative to the average across many years. So, what you see is that when it's red, the regions that are red means that the temperature is above this average value, right? And when you see the blue shade it means that it is below this average value. Of course, you can see how this evolves over time and also how it distributes across different geographical regions.