Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been experimenting with choropleth mapping techniques in R, having reaped the benefits of ggplot2 for creating beautiful graphs within a powerful data analysis package.

When it comes to mapping I've failed to produce results comparable to those I routinely get from QGIS. Using data of flow in Sheffield (fully replicable data and .qgs file here), QGIS easily produced the following:

QGIS image

The best I could produce using R (using code described here) were these two maps, the first using GISTools, the second using ggplot2:

GISTools choropleth ggplot2 choro

To me, the ggplot2 option seems far more attractive, if only I could solve the problem of the faulty lines (probably a problem with the fortify() command, or not reading in shapefiles using readOGR() described here.)

So the question is 2-fold: is the ggplot2 option the best choropleth mapping solution in R and, if so, how can I solve the problem of the faulty white lines?

Replicable code to find out what I've done is here.

Edit - Since made choropleth() output option more attractive:

New Rplot

The ugliness of this option can be reduced by exporting at higher resolution and removing the legend (other R legends are available). Still not managed to change line thickness but it's getting better! Red lines represent flows to zones which employ > 5000 people.

share|improve this question
The first R map would look alot nicer if you reduced the size of the polygon outlines (and perhaps made them completely transparent as in the first QGIS example). – Andy W Dec 8 '12 at 15:27
Agreed, but I don't know how to do this - the code I used was "choropleth(oas, v = oas$to, shades)". Searched for documentation to remove lines, but found nothing: – RobinLovelace Dec 8 '12 at 15:37
@RobinLovelace If you put your R code up we can surely help you with these issues, but without a reproducible example it's not easy to pinpoint the issues. I do appreciate the effort you have made to put up the (useful) screenshots, but the images are just the icing that should be delivered on top of the cake of the source code. – SlowLearner Dec 21 '12 at 7:10
Please see reproducible code contained in this .zip folder, as stated above: – RobinLovelace Dec 21 '12 at 7:59
@RobinLovelace Thanks, interesting, have downloaded – SlowLearner Dec 21 '12 at 11:09
up vote 6 down vote accepted

There are some great resources on exactly this very interesting subject, including:

From Revolutions:

Choropleth Map R Challenge

Choropleth Challenge Results

From Stack

Developing Geographic Thematic Maps with R

There are excellent examples of choropleth maps and their associated R code, including my favorite (i.e. attached map) using ggplot2. It should be relatively straight forward to insert your own data set into one of the script examples.

R Code for this map available from This is the Green Room

share|improve this answer
Many thanks for flagging these excellent resources and for showing the unemployment map of the USA. Missing a legend though! Any suggestions how to translate these resources into maps of Sheffield? Code snippets to sort out my failed attempt at choropleth mapping using ggplot2 and the data I've supplied of Sheffield very much appreciated! – RobinLovelace Dec 9 '12 at 17:07
@RobinLoveLace I'm glad the links were useful to you. You should have no problem plugging in your own dataset into the many sample scripts, although you may have to roll up your sleeves and do a bit of trial and error on the specific packages. Unfortunately, I do not have the time now to do it for you--sorry! – Aaron Dec 9 '12 at 17:22
I'll have a play and hopefully add further edits and replicable code when the map improves. – RobinLovelace Dec 9 '12 at 17:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.