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

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

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

- plotly for interactive graphs: examples here.
- googleVis
- 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:

- Narrate Change over time
- Start big and drill down
- Start small and zoom out
- Highlight contrasts
- Explore the intersection
- Dissect the factors
- Profile the outliers

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

- The Power of R and Visual Analytics
- Visual Analysis Best Practices
- Visualizing Time: Beyond the Line Chart

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

Here are some ggplot2 examples:

2. Pie charts

There are also ggplot2 extensions: http://www.ggplot2-exts.org/ to create more interesting graphs, for example:

Finally, some use cases/gallery:

- http://www.r-graph-gallery.com/
- Flowing Data’s Best Data Visualization Projects of 2016
- http://jkunst.com/r/pokemon-visualize-em-all/
- FBI’s aerial surveillance

## One Comment