Data Visualization with R
Last updated
Was this helpful?
Last updated
Was this helpful?
ggplot2
LibraryOne of the most proficient libraries for data visualization with R is ggplot2. In fact, the library is the reason why I prefer using R for more advanced visualizations that go beyond the capabilities of the Databricks standard features.
ggplot2 is based on . If you have never heard of ggplot2 or the grammar of graphics, read this fantastic introduction by Bradley Boehmke from the University of Cincinnati. He is also the author of the book :
The grammar [..] suggests the high-level aspects of a plot that can be changed, giving you a framework to think about graphics, and hopefully shortening the distance from mind to paper [3].
If you want to dive deeper, I recommend the book ggplot2: Elegant Graphics for Data Analysis. for which the 3rd edition soon to be published by Springer is available online:
[1] Boehmke, Ph D. Data Wrangling with R. 1st ed. 2016, Springer International Publishing : Imprint: Springer, 2016.
In brief, the grammar tells us that a graphic maps the data to the aesthetic attributes (colour, shape, size) of geometric objects (points, lines, bars). The plot may also include statistical transformations of the data and information about the plot’s coordinate system. Facetting can be used to plot for different subsets of the data. The combination of these independent components are what make up a graphic [].
On the , a development environment for the R language, you find a useful 2-page cheat sheet for the most important commands in ggplot2:
[2] Wickham, Hadley, and Garrett Grolemund. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. First edition, O’Reilly, 2016. Online:
[3] Wickham, Hadley. Ggplot2. Springer Science+Business Media, LLC, 2016. Preprint of 3rd edition online: