
ggplot2 - Create Elegant Data Visualisations Using the Grammar of …
A system for declaratively creating graphics, based on "The Grammar of Graphics". You provide the data, tell ggplot2 how to map variables to aesthetics, what graphical primitives to use, and it takes …
Introduction to ggplot2
ggplot2 is an R package for producing visualizations of data. Unlike many graphics packages, ggplot2 uses a conceptual framework based on the grammar of graphics. This allows you to ‘speak’ a graph …
Package index • ggplot2
All ggplot2 plots begin with a call to ggplot(), supplying default data and aesthetic mappings, specified by aes(). You then add layers, scales, coords and facets with +. To save a plot to disk, use ggsave().
ggplot2: Create Elegant Data Visualisations Using the Grammar of ...
A system for 'declaratively' creating graphics, based on "The Grammar of Graphics". You provide the data, tell 'ggplot2' how to map variables to aesthetics, what graphical primitives to use, and it takes …
Create a new ggplot — ggplot • ggplot2
ggplot() initializes a ggplot object. It can be used to declare the input data frame for a graphic and to specify the set of aesthetic mappings for the plot, intended to be common throughout all subsequent …
Bar charts — geom_bar • ggplot2
There are two types of bar charts: geom_bar() and geom_col(). geom_bar() makes the height of the bar proportional to the number of cases in each group (or if the weight aesthetic is supplied, the sum of …
Points — geom_point • ggplot2
The point geom is used to create scatterplots. The scatterplot is most useful for displaying the relationship between two continuous variables. It can be used to compare one continuous and one …
Complete themes — ggtheme • ggplot2
These are complete themes which control all non-data display. Use theme() if you just need to tweak the display of an existing theme.
Modify components of a theme - ggplot2
Themes are a powerful way to customize the non-data components of your plots: i.e. titles, labels, fonts, background, gridlines, and legends. Themes can be used to give plots a consistent customized look. …
Modify axis, legend, and plot labels — labs • ggplot2
Good labels are critical for making your plots accessible to a wider audience. Always ensure the axis and legend labels display the full variable name. Use the plot title and subtitle to explain the main …