Data Visualisation

ggplot2

If you are acquainted with R, data visualisation is easy with ggplot2. Say goodbye to your ugly excel plots! ggplot2 comes with Tidyverse but you can install the standalone package:

#install ggplot2
install.packages("ggplot2")

ggplot2 guides

This guide by STHDA is insanely helpful. It is a comprehensive guide that has codes for almost any plot and customisation you can think of and then some.

  • patchwork – ever wanted to combine two or more plots together to save space? Ever wanted to have a histogram next to a scatterplot? patchwork is the package for you! Install the patchwork package by pasting this code:

    #install patchwork
    install.packages("patchwork")
    
    Example of patchworked plots obtained from https://patchwork.data-imaginist.com/
    Example of patchworked plots obtained from https://patchwork.data-imaginist.com/
  • gganimate – an extension to ggplot2 that allows you to animate your ggplots and export them as GIFs or videos. Here’s a pretty comprehensive guide on how to do so. Install the gganimate package by pasting this code:

    #install gganimate
    install.packages("gganimate")
    
    Example of a gganimated plot obtained from https://github.com/thomasp85/gganimate
    Example of a gganimated plot obtained from https://github.com/thomasp85/gganimate
Previous