Rcartogram

Rcartogram_0.2-2.tar.gz

This is an interface to Mark Newmans cartogram code, and the technique of Newman and Gastner. This is used to produce spatial plots where the boundaries of regions can be transformed to be proportional to density/counts/populations. This is illustrated in plots such as
Mark Newman's plot of People living with HIV/AIDS
and
Michael Gastner's Cartogram of the US House of Representatives election, 2008

The technique is described in a paper.

This is currently a basic (and quickly implemented) interface to the cartogram code. It does not do much to make this more user-friendly for R users other than allowing one to call the functionality in the C code and creating matrices, etc. out of the results, providing a prediction method for mapping points on the grid onto the resulting cartogram. There are other things we can do with this. The current version doesn't even produce a plot! So plenty for people to add and contribute.

Download

The source for the package is available via Rcartogram_0.2-2.tar.gz.

Documentation

  • Changes
  • Demo

    We create a simple matrix (200 x 200) divided into 5 regions, with a rotated circle (or square) in the middle. Each of these regions has a different (population) density. We embed this in a bigger "sea" (300 x 300) and use cartogram() to "fit" the diffusion transformation. Then we superimpose the new regions. The result is the following:
    As we can see, the boundaries of the regions change in a non-linear manner. The top-right region which has population density 400 expands into the adjacent regions. The circular region has a higher population and so its density is diffused over a larger area. Note that it moves to accomodate the increased region in the top-right corner. The other regions change in size to equalize the population density.

    The code is in the demo/ directory of the package and can be run with demo(synthetic, package = "Rcartogram"). Alternatively, you can look at the code here and change the settings, e.g. the size of the grid, whether to use a circular region in the middle, the densities of the different regions.


    Duncan Temple Lang <duncan@wald.ucdavis.edu>
    Last modified: Sat Nov 15 13:05:14 PST 2008