# Should I use a discrete or continuous scale for coloring a chloropleth?

I am making a choropleth for an upcoming local race using D3. There are two candidates running for an election. For any given polygon on my map, if the red candidate has more votes, the color should be red. If the blue candidate has more votes, the color should be blue. If the blue candidate is winning by a lot, the color should be a deeper blue. If the red candidate is winning by a lot, the color should be a deeper red.

Should I use a discrete or continuous scale for this? Meaning, should I create a color ramp from red to blue for a given saturation or intensity. Or should I create bins such that if red/blue falls in a certain range, the polygon is assigned one of a few colors? From tutorials, it seems like most people make bins.

-
Also search the topic of bivariate color cartography/maps, just in case you'd like more ideas on your chosen technique. – Martin F Feb 17 '14 at 2:20
Balanced data (two categories, increase in one necessarily implies a decrease in the other), can be conceived of as a single variable. Since in many elections the vast majority of votes are for two candidates (even if there are more than two candidates in the race), an increase for one is a decrease for another. Therefore, this doesn't really need to be thought of as a bivariate map. – Lee Hachadoorian Mar 1 '14 at 3:32

There are benefits and drawbacks to each way of doing it. To make a long story short, I would recommend creating "bins." A couple of notes to help you choose, and about designing choropleths in general:

A direct mapping of data value to color (an 'unclassed' map) could be considered the most accurate way to display the data, however classified maps (maps with 'bins') can be more legible for several reasons.

If you use an unclassed map and the data are skewed, or there are outliers in the data set, the outliers will stand out clearly, while many of the polygons can end up very similar in color. This would highlight the fact that a few areas are radically different than others (in your case, if a couple of areas had a significantly greater preference for one candidate over the other than most areas), but it is more difficult to distinguish the relationships within the rest of the map area.

In a classed map, each class should be visually distinct, so it is easy to tell where an area lies in the data, at the cost of some of the finer distinctions being lost.

Another problem is that perception of color intensity is not strictly linear. So if you had a color ramp from white to blue, corresponding to no candidate receiving more votes to the maximum lead for one candidate, the color that is 75% of the way between white and blue might not be perceived as being 75% of the way between the two colors, and therefore the map user would make a false assumption about what data value it represented.

Classed maps, on the other hand, can have the color of each class carefully chosen to be perceived clearly and distinctly. I do not know enough to design a set of colors that does this, but Cynthia Brewer and Mark Harrower do, and they created colorbrewer2.org, a great (free) tool to help cartographers choose good color schemes for their maps. You can choose from a variety of schemes, choose the number of classes, and it gives a preview of what the scheme might look like in practice, and the RBG, HEX, or CMYK values for each color in the scheme. Very useful, and simply fun to play with.

For these reasons, I would recommend making a classed map. The recommended number of classes is usually an odd number from 5-9 or so. Using an odd number gives a distinct average value, and this number of classes is generally considered to be enough to give useful distinctions in the data, but not too many so as to become indistinguishable. Since you are using a diverging color scheme (light color in the middle, two different colors at each end), you can get away with more classes, perhaps 7-9.

Head over to colorbrewer, choose "diverging" for the nature of your data, select the red to blue color scheme, choose your number of classes, and away you go!

For much of this, there is not a hard rule. The standard is, "does the map communicate the data well?" Playing around with parameters until you get something that "works" can be a good thing.

Now, a note on making choropleths. My apologies if this is familiar ground for you:

A point of interest when using a classed map is how the data is divided into classes. Is it broken at equal intervals along the range? Are a certain number of data points assigned to each class? A certain number of standard deviations from the mean? Is it broken at "natural" breaks in the data? Which method you use makes a difference in how data are portrayed. I am not much of a programmer, and I am not sure which method the script you link to uses. "Natural breaks" are usually a good choice. For data with a clear midpoint like polling data (the midpoint being a 50/50 split), standard deviations can be useful.

When making a choropleth, it is good to use data that is standardized over a unit of area. For instance, instead of using total population in a county, it is better to map population per square mile in each county. The reason being that a larger area will tend to have more people in it than a smaller one, so dividing by the area of each mapped unit gives a more accurate portrayal of trends. Data can also be standardized as a percent. For instance, a poverty rate rather than a number of people in poverty.

For your purposes, it is more revealing to map percentage of votes cast for a candidate than raw number of votes cast for that candidate.

Anyway, I hope some of this is useful, and that your map turns out well!

For much of this discussion I drew on Thematic Cartography and Geovisualization by Slocum et al.

-

You address one of many aspects of symbolization: how to portray quantitative values via variable color representation -- using a discrete or continuous scale of color saturation or intensity. Good question. The answer is, as often, it depends...

Traditional thematic cartography recognizes that maps, as simplified models of reality, are products of a great deal of generalization. For simplicity's sake, quantities are grouped into classes (bins) -- and there have been many discussions on just how many such classes there should be (5 or 7 were often touted). The advantages: much simpler to construct using traditional photo-mechanical methods, and easier to get the message across. Look, here Red Ken is favored, while over there, Blue Peter.

Contemporary thematic cartography allows maps of far greater detail where continuous quantities can be represented by color scales of very high ranges. The advantages: more objective and detailed. Map readers can potentially recreate the source data with more precision.

So, what is the deeper purpose of your map?

Do you wish to be more objective, exploring the detailed variations present in the data? Use the continuous color scales. This "map as tool of investigation" concept comes with (new) names like "data visualization" and "heat mapping".

Do you wish to tell a simple story? Use discrete color scales. This is "map as tool of communication".

Since your map is already highly generalized spatially, into voting regions, I might suggest using continuous color scales as a compromise -- you have spatial discretization but statistical continuity. Just an idea.

Ultimately, it's up to you. Why not experiment with a few variations?

-

I see two Options:

a) you only use bins: (numbers are just an example)

• Candidate Red has > 50% - 70% of the votes -> colour light red
• Candidate Red has > 70% of the votes -> colour is deep red
• for blue accordingly

b) you use a Color ramp.

• continous colorramp from light red/blue to deep red/blue with a continous mapping of values from >50% to 100% to colours of light to deep red/blue.

What you Chose depends on what you want to communicate with the map. If the info "is winning" and "is winning by xy%" is enough, Chose a). If your Readers should be able to estimate by how many % candidate red or blue is leading, choose b)

-