Know India through Visualisations – 1
[This article was first published on Just Another Data Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
I’m going to produce just a couple of charts, a teaser of sorts in this post. In the forthcoming posts I’ll dig deeper.
I was amazed with the existing list of R packages to work with spatial data, without needing to get into much of the technical details. Various R packages I’ve used are described along with the code.
I’ve obtained the state level power supply position data for the November 2004 (just a random choice) from the data portal of the government of India website. The spatial data for India with state boundaries was obtained from Global Administrative Areas website.
Above plot is generated using spplot() function from sp package, below is a similar plot generated using ggplot() function from ggplot2 package. In the plot, darker shades of blue signify higher severity of electricity shortage and lighter shades signify lower severity as can be seen from the legend. The numbers in the legend are in MU i.e. Million Units (equivalent to gigawatt hour).
The advantage of using ggplot() is that I can add additional layers onto this map easily. For e.g. I can add labels of the states as can be seen below.
The R Code for this post is shown below and can also be found on this GitHub Gist.
I was amazed with the existing list of R packages to work with spatial data, without needing to get into much of the technical details. Various R packages I’ve used are described along with the code.
I’ve obtained the state level power supply position data for the November 2004 (just a random choice) from the data portal of the government of India website. The spatial data for India with state boundaries was obtained from Global Administrative Areas website.
The advantage of using ggplot() is that I can add additional layers onto this map easily. For e.g. I can add labels of the states as can be seen below.
The R Code for this post is shown below and can also be found on this GitHub Gist.
To leave a comment for the author, please follow the link and comment on their blog: Just Another Data Blog.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.