Transparent hurricane paths in R

Arthur Charpentier has written a really nice blog post about obtaining hurricane tracks and plotting them. He then goes on to do other clever Markov process models, but as a dataviz guy who knows almost nothing about meteorology, I want to suggest just a small improvement to the maps. Almost every graphic with a lot of data benefits from transparency. It’s easy to add in R too, you can just specify a color with a function like rgb(). Here’s the opaque version:

hurricanes

and here it is with color=”red” replaced by color=rgb(255,0,0,18,maxColorValue=255).

transparent-hurricanes

The only other thing I did to Arthur’s code was to wrap the crucial TOTTRACK line in a try() function because some of the files came back with error 404, and you don’t want to stop just for a few ol’ hurricanes:

try(TOTTRACK<-rbind(TOTTRACK,extract.track(y)),silent=FALSE)

Longer-term, it would be worth trying to replace the tracks with splines to avoid jumpiness, and it does look like there’s some dirt in the data: what are those tracks going straight from the Azores to Iceland?

Advertisements

3 Comments

Filed under R

3 responses to “Transparent hurricane paths in R

  1. Thanks Robert for the post, and for the hint on the colors…
    about the try(), I am a huge fan of that function (that everyone needs when reunning intensive monte carlo simulations). But here, actually, one can fix it (manually) : there are 8 or 9 types, easily spoted (e.g. NINETEE instead of NINETEEN, etc)
    I will have to remember that rgb function !

  2. Pingback: Plot Me Like a Hurricane (a.k.a. animating historical North Atlantic basin tropical storm tracks) | rud.is

  3. Pingback: Repaired R code for Markov spatial simulation of hurricane tracks from historical trajectories | Hypergeometric

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s