Tuesday, August 7, 2012

Provincial Monthly Rainfall of the Philippines from WORLDCLIM

Preparing for a future conference on climate change, I downloaded and extracted average monthly rainfall in the Philippines from worldclim.org. Using maptools, raster, and animation package in R, I produced an animation of average monthly rainfall of the country.


  1. Hi,arsalvacion. It's a very nice graph.
    I am working in New Zealand. I am wanting to produce something very similar to your stuff.
    I am wondering if you can share your code with me.

    Thanks in advance.
    My email address is gylamb@gmail.com

  2. Hi Yang,

    I just save each file as png (e.g. Rainfall1.png to Rainfall12.png) the use the code (below) sent to me by Yihui Xie to produce the GIF file.

    files = sprintf('Rainfall%d.png', 1:12)
    im.convert(files, output = 'Rainfall.gif')

    Best regards,


    1. Hi ARSalvacion,
      I liked your animated example. However, when I tried to do the same with my own data, I am unable to display the data by polygons just like what you have done.
      Can you please show me the code you have used to display such kind of beautiful map?
      Vanya Charles

  3. Hi, arsalvacion! I was led onto your blog through the R-bloggers. Nice graph!
    I'm doing a paper on institutions and poverty. I want to include geophysical attributes, including average rainfall and average elevation, in my model to control for potential development. Do you have any idea where to get these data by municipality, or how I can generate them?

  4. This comment has been removed by the author.