Data Visualization with R

This post is part of Data Science with R.

Producing clean graphs in R can be a challenging task, but when done right, graphs can be appealing, informative, and of considerable value. Traditionally, R was used for producing graphs in academic article, but it’s now so versatile that you can produce stunning data visualizations in just few lines of codes:

What we learnt from the video is that beautiful visualizations can be made easily with

  1. leaflet for maps
  2. quantmod for easy stock data visualization
  3. dygraph for time series data
  4. corrplot for correlation plots: example here
  5. ggvis for interactive graphics using ggplot-like syntax

Having said that, these are my favourite visualization frameworks because they are so versatile:

  1. plotly for interactive graphs: examples here.
  2. googleVis
  3. shiny for dashboards: example here

But how to select which type of chart to use? The following diagram would help (or this whitepaper from Tableau).


PS: Some people say pie charts are no good, but sometimes it can be useful.

There are, by the way, 7 different types of data stories:

  1. Narrate Change over time
  2. Start big and drill down
  3. Start small and zoom out
  4. Highlight contrasts
  5. Explore the intersection
  6. Dissect the factors
  7. Profile the outliers

Meanwhile, Tableau has some whitepapers related to producing visualizations with R:

When it’s precision over storytelling, we may need to go back old-school: ggplot2! (here’s a cheatsheet)

Here are some ggplot2 examples:

  1. High density scatter plots


2. Pie charts


There are also ggplot2 extensions: to create more interesting graphs, for example:


Finally, some use cases/gallery:

  2. Flowing Data’s Best Data Visualization Projects of 2016
  4. FBI’s aerial surveillance

1 Comment

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s