Understanding Ordinal Scales

Ordinal scales can transform categories of data into discrete datasets.

We'll cover the following

We are going to paint each arc a unique color. In the past few projects, we have been assigning custom colors to our images. However, that is not going to cut it for this project. Regardless of how many groups or arcs we have in our pie, each arc should have a unique color. We also want our chart to be scalable.

Let’s say we had more age groups in our data. We would need to generate a new color for each additional group. One option would be to add a color manually. However, that is not scalable. It would be better if our chart could generate a new color for each age group. If we need to add more groups, we should generate random colors automatically.

What’s an ordinal scale?

To help us with adding colors, we are going to use what is called an ordinal scale. It is one of the most commonly used scales. Let’s talk about what an ordinal scale is before jumping into the code.

An ordinal scale will transform discrete data into discrete data. We have to ask ourselves, when would we want to do this type of transformation? Throughout most of this course, we have been transforming values such as temperatures, distance, population, and other types of data. The one thing they all have in common is that they are numbers.

It can be easy to transform numbers into other numbers or even colors. However, there will be times where you will want to transform “things.” For example, the months in a year. Or, how about the names of people or locations? You may want to transform these things into numbers or colors. That is where the ordinal scale comes into play. It is able to transform “things” into values that you can use for drawing a chart.

Let’s look at an example.

Get hands-on with 1200+ tech skills courses.