Image credit: [Maja Ilić]

Pretty plots in R

Plotting, plotting, plotting…

Image credit: [Maja Ilić]

Pretty plots in R

Plotting, plotting, plotting…

What is (one of) the best things to do on a rainy saturday? Yes, plotting pretty plots in R!

Background story

During my writing up phase, which I spent with my grandparents in Croatia, in their house where I grew up, I came up with a “nice idea”: I was dreaming of a website, my own, where I could post pretty plots and provide the R code for these. Well, “dreaming” is too much to say, especially now that I do have a website which was much easier to create than previously assumed. In the meanwhile, I realized: my “nice idea” is nothing so new, creative and innovative. Especially through Twitter, I figured out that there are many other people doing exactly the same - sharing nice plots and the R code to produce them. And although at first I was a bit disappointed, I see it differently now - I might not be the only one wanting to share plots, but therefore I can definitely benefit from the other people that do so! One of these people I follow on Twitter is Cédric Scherer. Most of his plots and R code can be found on his GitHub, while many other helpful links and material can be found on his Website. One thing I can say is: “Wow!”. Great website, great plots, so creative. I am still not at that level, but working on it. I did not want to completely give up on my idea, so I will try to post a few plots on this website. If you should have any questions or ideas, you can always contact me!

Be creative, learn and have fun

Inspired by Cédrics plots (I love his choice of colors and fonts), I updated one of the plots I posted once on Twitter, as a response to a request asking about a R code to produce a “half-boxplot-half-violinplot”. You can see my original response here. The new plot is provided in a “cold colors” version (see the head of the post) and a “warm colors” version (see below). Credit mostly goes to the authors of the original script. Although it does not seem to be something “too special”, it is a nice small plot that might serves as a good introduction into “beyond basic plotting in ggplot”.

Another plot you can see below is a map of Ireland and United Kingdom with pie charts, showing hypothetical proportions of 5 different fish stocks in a hypothetical fish catch at 5 different spots. This is just a result of a “demo script” for plots like this one. I wrote the script for one of my current colleagues, who is working on a developement of innovative fisheries management in Celtic Sea (well, he probably could have done it himself - he is such a genious and I have learnd so much from him - but I really wanted to do something cool for him). This plot was not that easy to do (the right projection is the key!), but with some help (thank you Google, as always), I managed to finalize it. Both plots are still “nothing special” compared to Cédrics plots, but it’s a good start, I think :)

Avatar
Dr. Maja Ilić
Data Analyst/R Programmer in Ecology