Once you have your data available to you and you want to actually start to drawing with this information, one important thing is how we convert data from the original format to a format that I can use to draw. So for example, imagine that I have a dataset where we have the ages of my clients or a list of people. Now what I want to do is to map the age of each people to the height of a bar. So, for example, if my maximum person in my dataset has 64 years old, what we can do is map this one to the tallest bar that I have. Someone with half his age is going to have half the size of the bar. But now the problem is, how much pixels is each of those? So, if I have 64, what should be the size in pixel of the bar? Or if I have half of that 32, what would be the size in pixels of that? It cannot be just 64 or 32 because then I get limited to a size of a chart and also if my dataset grows, my chart's going to change in ratio and it's kind of thing here we don't want that. We want to be able to convert from the numbers that I have in my dataset to numbers that I can use that is basically the height of my bar. To do that, one option is using numerical scales. The goal of numerical scales is basically getting some information that you have in your dataset and then you split in the information that is equivalent to the graphical space. So, we get data in the data space and we output data on the image space, so now we can use this information to draw. So, for example, one of such scale is the scaleLinear. If you are dealing for example with bar charts or other types of charts where the numbers are proportional to each other, as I showed in the beginning, if half of the number in the dataset is also half of the number on the graphical or the image space, then we can use the scaleLinear. All the scales follow very much the same pattern. So, we first going to create these scales so here, for example, we have data scaleLinear, where we create this scale, then after that, we're going to have the domain. The domain is basically what set of numbers we can have in the data space. So, think about main data space and it's basically, if I have a dataset with ages for example, and the oldest person is 64 years old, we're going to have the domain going from zero to 64. And why the domain goes from zero? Because you don't want to cut your access. So, even if the youngest person is for example 10 years old, you don't want to start from 10 because then the proportions between your bars are not going to be the same. So be very careful when you select the domain because in some cases, you want to go from the minimum to the maximum but in some cases, you want to go from zero to the maximum. You want to make sure that the interpretation of your short is correct when you make this decision. The next step is range. Range is basically the graphical space. So, if the domain is the set of numbers that we can assume in the data space, the range is the set of numbers that we can assume on the graphic space. In most of this case, this is from the minimum to the maximum size that we can have. So, for example with a bar chart, that is going to be from zero because the minimum a bar can go is zero and to the maximum that if you want the tallest bar to have 100 pixel would be 100 pixel. The same thing goes with the domain. In some cases, you want this minimum to be something actual, the minimum value that you want to have, or sometimes, you want this to be zero, you have to be very careful in your choices to make sure that the interpretation of your chart is correct. So here we have an example. So here, what we are doing is we are creating a scaleLinear and then after we create this scale, we call that domain, and here we are saying that our domain goes from zero to 64. As I say, these are my ages so this means that the oldest person that I have in the dataset is 64 years old and therefore the tallest bar is going to be correlated to this person. Then we have our range that goes from zero to 300. So, this means that our tallest bar is going to have 300 pixels. So now, if I ask my scales, so as I create this scale, what I end up with is a function and now I can call this function with the values. So, if I call a scale with the value 64, that is my maximum value, I'm going to get my maximum value in range that is 300. If I call it with zero, that is my minimum value, I'm going to get the minimum value in the range that is zero. If I call it with the middle value, for example 32, I'm going to get the middle value also in the range that is 152. But linear scales are not the only one that we can use. We can actually use different types of scales. So one for example, is the square root scale. That one is using for if we're mapping two size of circles and you want to map to the area of the circle other than just the radius. The standard is still the same, the pattern is you create the scale. The only difference is that the name now is scaleSqrt, and then you call the domain with your extent and you call your range with your extent. So here we're going to see an example. We again are doing the exact same domain in the exact same extent. We go from zero to 64 in the domain and from zero to 300 on the range and we are creating our scale. So the only thing we changed from the previous example is that now we are using a square root scale. So now if I call it to the maximum, I should get the maximum. So, 64, it returns 300. If I call the minimum, zero return zero but if I call the middle value, now I get a different picture. I get a higher number than I get before because now, my scale is exponential. So, it's when I get to the middle, actually, in the graphical space, I'm further on my range of values. So, as I say, different types of scales is going to use different things in the middle. Most of the time the minimum and the maximum is going to be the same but how they interpolate between those values is what's going to change. So, the same thing happen with all the scales that we have in the three as well. So, we're always going to use numeric scale to translate numbers from the data to numbers in the graphic space. We have different types of scales. Linear is one that is most used but in some cases you may want to use a square root because you want to map to some type of area or something like that or you may want to use logarithmic scales. Logarithmic scales has the advantage of mitigate the effect of outlier. If you have one element that is much bigger than the older one, logarithmic scale is going to try to push those down a little bit so you have a more smooth curve. But the price, you have the risk of misinterpretation of your chart. So be very careful on which scale you choose, making sure that whoever is going to look in your chart is actually reading the values correctly. This is one very important step towards that, it's choosing your scale.