ggplot2 – first steps
ggplot2
(an acronym for Grammar of Graphics plot) is the most popular graphical package in R. This relies mainly on the fact that almost anything can be drawn with it. This huge flexibility, however, implies more complexity while drawing.
The underlying concept of ggplot2
is an empty canvas. Instead of specifying the type of plot and the data to be visualized, the ggplot2
functions expect vectors that denote positions, widths, sizes, and so on. From its conceptual point of view, this is very similar to an HTML document; this is an empty space that is filled with different objects to which different characteristics are specified. The following example is the equivalent of plot(iris$Sepal.Length
):
ggplot.graph <- ggplot(data=iris) ...
Get Learning Shiny now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.