How to make a good color intensity scale?

I am by no means good in statistics, but I think I have come to the right place. My question is simple:

My problem consists of comparing the population of several states in a small country, but some states have a population of 3000,000 and some a population of 2,000.
I am painting it on a map, and the "intensity" of the color depends on how the population of every state compares to the population of the whole country.

The problem is that the states with a lot of population are shown with really intense colors and the small states barely have any color.

Is there an easy way to "normalize" or make the data comparable?

I dont know if I am explaining myself properly but I hope some one can help me. Please comment if my question is not clear and I will clarify.

Thank you for your help!

• I would suggest you check out the visualization tag over at the gis stack exchange site for examples gis.stackexchange.com/questions/tagged/visualisation – Andy W Mar 20 '11 at 16:07
• Along that same line, you might want to check out the gradients on www.0to255.com . – Pete Wilson Mar 20 '11 at 19:08
• Some of the maps packages for R have built-in colour codes that prevent this kind of issue, but is that what you were asking about? – Fr. Mar 21 '11 at 22:32
• I am using this on a custom map, and the obvious approach (to divide each value by the total population) does give me a value between 0 and 1 (I then use this value to choose the "intensity" of the color). The problem is that there are values that are too far appart, so some states look completely colored and some have almost no color at all. I know statistically speaking this is correct but I want to make the data representation more relevant and easier to understand. – Zebs Mar 22 '11 at 1:05
• Why use uniform breaks? Why not a log scale? Or perhaps in your application you could choose breakpoints that have some meaning (e.g. rural/suburban/urban). – JMS May 13 '11 at 21:49

I'm sorry, but to me it sounds like you are trying to fix what isn't broken. In fact, you might even be trying to break what isn't broken. When you have a quantitative variable (here, population) that spans a wide range, then whatever metric you use to represent it should also span a wide range.

But for all things related to color (and esp. maps), the key source is, I think ColorBrewer

• I am trying to break something; I know the vales I am getting are statistically correct, but I want to make it easier for the users to understand the data. It's a UI decision. – Zebs Mar 22 '11 at 4:04
• @Zebs: Bend, more like.. – naught101 May 1 '12 at 7:44

Good question, One solution is to rescale the colors to have them more uniformly distributed, or to a distribution with lower tails... but then your legend has to be clear enough because deforming the scale, somehow, is unfair...

For example, in R, rescaling a normal to a uniform . (what you have maybe goes more the other way since you have large tails and you want them smaller, but the principle is the same)

X=array(rnorm(10000),c(100,100))
ramp=colorRamp(c("blue","cyan","white","yellow","red"),space ="rgb")
kleur <- rgb( ramp(seq(0,1,length=200)),max = 255)
par(mfrow=c(1,2))
image(X,col=kleur)### image without rescaling
Fn=ecdf(X)
ScaledX=array(Fn(X),c(100,100))
image(ScaledX,col=kleur)


You could divide by the total population. This would ensure that everything lies between 0 and 1. If the scales are still too disparate, consider a log scale.

I feel awkward asking it, but are you really committed to using colour to portray a quantitative amount? Is there no way to put a bar in each state, whose height represents the quantity?

Another way might be to show the map with areas representing the geographic areas, together with a map where each state's area is proportional to the population size - similar to how the sensory homunculus does. But that would be a painful amount of drawing - I don't know of any way to automate that (though it may exist)

• Good remark ! – robin girard Mar 20 '11 at 13:46
• Many mapping software platforms have the capabilities mentioned in this post. The distortions based on attributes when it comes to maps are frequently referred to as cartograms. See gis.stackexchange.com/q/7406/751 . That being said, bars placed happenstance in a map aren't any easier to visualize than colors. When the bars aren't side by side they are difficult to make relative comparisons, which isn't as big a problem with a color scale. – Andy W Mar 20 '11 at 16:12
• I agree that bars less than optimal on a map. Another way to do it is to have gridded distortions, like here: viewsoftheworld.net/?p=832. Personally, I often find these quite hard to decipher, but they can be done quite well, depending on the amount of distortion. – naught101 May 1 '12 at 7:48

Compare the population of several states in a small country.

Since some states have a population of 3000,000 and some a population of 2,000. Is there an easy way to "normalise" or make the data comparable?

Aim of normalising your data before mapping

This answer will be lacking since I am not sure of the context of why you are making the map.

Nevertheless, here are some thoughts to explore: Normalise your data so that the map provides interesting meaning to the map's potential readers, so they can link what they see on your map to some concept they normally think about. Basically, I think your new normalised numbers should be linked to some qualitative concept that the map readers find interesting to understand (random tidbit: Measure = Quantity x Quality, Hegel).

Two proposed ways to normalise your data

1. In order to give a sense of how much open space is in each state.

Create a new state variable for population density by calculating the population divided by total state area.

2. In order to make the coloring of the states contrast with one another.

Create a new state variable by calculating the deviation from the mean of each state. For example, say you have 3 states with populations as follows:

• State A is 100.
• State B is 50.
• State C is 1.

The mean will be be about 50.

The new variable's values for each state will be as follows:

• State A is +50 (color intense green).
• State B is 0 (color grey).
• State C is -49 (color intense red).

You can use any color scheme where positive numbers contrast with negative numbers (google 'colorbrewer' for lots of examples of color schemes for maps).