Drawing polar centered spatial maps using ggplot2

Drawing maps of the polar regions can be done using square spatial maps. A small example says more than a thousand words:

The final call to ggplot results in the following picture:

A much more natural way of plotting this polar centered data would be to use polar coordinates. This is supported by ggplot2 through the coord_polar() command. In code (with great help from Charlotte Wickham) this results in:

Note that I use theme_blank() many times to get rid of certain elements of the plot (rectangle around the plot, y-axis etc). In addition, the calls to x_lim and y_lim are necessary. Charlotte Wickham explains (direct quote from ggplot2 mailing list): The little additions to the limits make sure the entire cell in plotted without any gaps. It might make more sense to have: x_cell_lim <- c(180, -180) + c(1, +1) * res/2, assuming cells centered at 180 and -180 longitude are the same. The above call to ggplot resuls in the following plot:

Note that the grid cells are nicely scaled towards the north pole. In my opinion this is a much more effective plot for showing polar oriented data.

Tagged with: , , , ,
Posted in R stuff

Leave a Reply

Your email address will not be published. Required fields are marked *


To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax