i

R Programming Complete Tutorial

Graphics with ggplot2

ggplot2 is a powerful and flexible R package for producing elegant graphics. The gg in ggplot2 means Grammar of Graphics, a graphic concept which describes plots by using a grammar.

The main difference is that, unlike base graphics, ggplot works with data frames and not individual vectors. All the data needed to make the plot is typically be contained within the data frame supplied to the ggplot() itself or can be provided to respective geoms.

Properties of ggplot:

    • the consistent underlying grammar of graphics

    • plot specification at a high level of abstraction

    • very flexible

    • theme system for polishing plot appearance

    • mature and complete graphics system