R: Create Elegant Data Visualisations Using the Grammar of Graphics

# Create Elegant Data Visualisations Using the Grammar of Graphics

## Documentation for package ‘ggplot2’ version 4.0.3

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

A B C D E F G H L M P Q R S T U V X Y misc

## -- A --

add_gg | Add components to a plot
aes | Construct aesthetic mappings
aes_colour_fill_alpha | Colour related aesthetics: colour, fill, and alpha
aes_eval | Control aesthetic evaluation
aes_group_order | Aesthetics: grouping
aes_linetype_size_shape | Differentiation related aesthetics: linetype, size, shape
aes_position | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
after_scale | Control aesthetic evaluation
after_stat | Control aesthetic evaluation
alt_text | Extract alt text from a plot
annotate | Create an annotation layer
annotation_borders | Create a layer of map borders
annotation_custom | Annotation: Custom grob
annotation_logticks | Annotation: log tick marks
annotation_map | Annotation: a map
annotation_raster | Annotation: high-performance rectangular tiling
autolayer | Create a ggplot layer appropriate to a particular data type
automatic_plotting | Tailoring plots to particular data types
autoplot | Create a complete ggplot appropriate to a particular data type

## -- B --

borders | Create a layer of map borders

## -- C --

color | Colour related aesthetics: colour, fill, and alpha
colour | Colour related aesthetics: colour, fill, and alpha
CoordSf | Visualise sf objects
coord_cartesian | Cartesian coordinates
coord_equal | Cartesian coordinates with fixed "aspect ratio"
coord_fixed | Cartesian coordinates with fixed "aspect ratio"
coord_flip | Cartesian coordinates with x and y flipped
coord_map | Map projections
coord_polar | Polar coordinates
coord_quickmap | Map projections
coord_radial | Polar coordinates
coord_sf | Visualise sf objects
coord_trans | Transformed Cartesian coordinate system
coord_transform | Transformed Cartesian coordinate system
cut_interval | Discretise numeric data into categorical
cut_number | Discretise numeric data into categorical
cut_width | Discretise numeric data into categorical

## -- D --

derive | Specify a secondary axis
diamonds | Prices of over 50,000 round cut diamonds
draw_key | Key glyphs for legends
draw_key_abline | Key glyphs for legends
draw_key_blank | Key glyphs for legends
draw_key_boxplot | Key glyphs for legends
draw_key_crossbar | Key glyphs for legends
draw_key_dotplot | Key glyphs for legends
draw_key_label | Key glyphs for legends
draw_key_linerange | Key glyphs for legends
draw_key_path | Key glyphs for legends
draw_key_point | Key glyphs for legends
draw_key_pointrange | Key glyphs for legends
draw_key_polygon | Key glyphs for legends
draw_key_rect | Key glyphs for legends
draw_key_smooth | Key glyphs for legends
draw_key_text | Key glyphs for legends
draw_key_timeseries | Key glyphs for legends
draw_key_vline | Key glyphs for legends
draw_key_vpath | Key glyphs for legends
dup_axis | Specify a secondary axis

## -- E --

economics | US economic time series
economics_long | US economic time series
element | Theme elements
element_blank | Theme elements
element_geom | Theme elements
element_line | Theme elements
element_point | Theme elements
element_polygon | Theme elements
element_rect | Theme elements
element_text | Theme elements
expand_limits | Expand the plot limits, using data
expand_scale | Generate expansion vector for scales
expansion | Generate expansion vector for scales

## -- F --

facet_grid | Lay out panels in a grid
facet_wrap | Wrap a 1d ribbon of panels into 2d
faithfuld | 2d density estimate of Old Faithful data
fill | Colour related aesthetics: colour, fill, and alpha
format.ggproto | Format or print a ggproto object
fortify | Fortify a model with data.
from_theme | Control aesthetic evaluation

## -- G --

GeomSf | Visualise sf objects
geom_abline | Reference lines: horizontal, vertical, and diagonal
geom_area | Ribbons and area plots
geom_bar | Bar charts
geom_bin2d | Heatmap of 2d bin counts
geom_bin_2d | Heatmap of 2d bin counts
geom_blank | Draw nothing
geom_boxplot | A box and whiskers plot (in the style of Tukey)
geom_col | Bar charts
geom_contour | 2D contours of a 3D surface
geom_contour_filled | 2D contours of a 3D surface
geom_count | Count overlapping points
geom_crossbar | Vertical intervals: lines, crossbars & errorbars
geom_curve | Line segments and curves
geom_density | Smoothed density estimates
geom_density2d | Contours of a 2D density estimate
geom_density2d_filled | Contours of a 2D density estimate
geom_density_2d | Contours of a 2D density estimate
geom_density_2d_filled | Contours of a 2D density estimate
geom_dotplot | Dot plot
geom_errorbar | Vertical intervals: lines, crossbars & errorbars
geom_errorbarh | Vertical intervals: lines, crossbars & errorbars
geom_freqpoly | Histograms and frequency polygons
geom_function | Draw a function as a continuous curve
geom_hex | Hexagonal heatmap of 2d bin counts
geom_histogram | Histograms and frequency polygons
geom_hline | Reference lines: horizontal, vertical, and diagonal
geom_jitter | Jittered points
geom_label | Text
geom_line | Connect observations
geom_linerange | Vertical intervals: lines, crossbars & errorbars
geom_map | Polygons from a reference map
geom_path | Connect observations
geom_point | Points
geom_pointrange | Vertical intervals: lines, crossbars & errorbars
geom_polygon | Polygons
geom_qq | A quantile-quantile plot
geom_qq_line | A quantile-quantile plot
geom_quantile | Quantile regression
geom_raster | Rectangles
geom_rect | Rectangles
geom_ribbon | Ribbons and area plots
geom_rug | Rug plots in the margins
geom_segment | Line segments and curves
geom_sf | Visualise sf objects
geom_sf_label | Visualise sf objects
geom_sf_text | Visualise sf objects
geom_smooth | Smoothed conditional means
geom_spoke | Line segments parameterised by location, direction and distance
geom_step | Connect observations
geom_text | Text
geom_tile | Rectangles
geom_violin | Violin plot
geom_vline | Reference lines: horizontal, vertical, and diagonal
get_alt_text | Extract alt text from a plot
get_labs | Modify axis, legend, and plot labels
get_theme | Get, set, and modify the active theme
ggplot | Create a new ggplot
ggproto | Create a new ggproto object
ggproto_parent | Create a new ggproto object
ggsave | Save a ggplot (or other grid object) with sensible defaults
ggsf | Visualise sf objects
ggtitle | Modify axis, legend, and plot labels
group | Aesthetics: grouping
guides | Set guides for each scale
guide_axis | Axis guide
guide_axis_logticks | Axis with logarithmic tick marks
guide_axis_stack | Stacked axis guides
guide_axis_theta | Angle axis guide
guide_bins | A binned version of guide_legend
guide_colorbar | Continuous colour bar guide
guide_colorsteps | Discretized colourbar guide
guide_colourbar | Continuous colour bar guide
guide_coloursteps | Discretized colourbar guide
guide_custom | Custom guides
guide_legend | Legend guide
guide_none | Empty guide

## -- H --

hmisc | A selection of summary functions from Hmisc

## -- L --

labeller | Construct labelling specification
labellers | Useful labeller functions
label_both | Useful labeller functions
label_bquote | Label with mathematical expressions
label_context | Useful labeller functions
label_parsed | Useful labeller functions
label_value | Useful labeller functions
label_wrap_gen | Useful labeller functions
labs | Modify axis, legend, and plot labels
layer_geoms | Layer geometry display
layer_positions | Layer position adjustments
layer_stats | Layer statistical transformations
lims | Set scale limits
linetype | Differentiation related aesthetics: linetype, size, shape
luv_colours | 'colors()' in Luv space

## -- M --

margin | Theme elements
margin_auto | Theme elements
margin_part | Theme elements
mean_cl_boot | A selection of summary functions from Hmisc
mean_cl_normal | A selection of summary functions from Hmisc
mean_sdl | A selection of summary functions from Hmisc
mean_se | Calculate mean and standard error of the mean
median_hilow | A selection of summary functions from Hmisc
midwest | Midwest demographics
mpg | Fuel economy data from 1999 to 2008 for 38 popular models of cars
msleep | An updated and expanded version of the mammals sleep dataset

## -- P --

plot.ggplot | Explicitly draw plot
position_dodge | Dodge overlapping objects side-to-side
position_dodge2 | Dodge overlapping objects side-to-side
position_fill | Stack overlapping objects on top of each another
position_identity | Don't adjust position
position_jitter | Jitter points to avoid overplotting
position_jitterdodge | Simultaneously dodge and jitter
position_nudge | Nudge points a fixed distance
position_stack | Stack overlapping objects on top of each another
presidential | Terms of 12 presidents from Eisenhower to Trump
print.ggplot | Explicitly draw plot
print.ggproto | Format or print a ggproto object

## -- Q --

qplot | Quick plot
quickplot | Quick plot

## -- R --

rel | Theme elements
replace_theme | Get, set, and modify the active theme
resolution | Compute the "resolution" of a numeric vector

## -- S --

scale_alpha | Alpha transparency scales
scale_alpha_binned | Alpha transparency scales
scale_alpha_continuous | Alpha transparency scales
scale_alpha_date | Alpha transparency scales
scale_alpha_datetime | Alpha transparency scales
scale_alpha_discrete | Alpha transparency scales
scale_alpha_identity | Use values without scaling
scale_alpha_manual | Create your own discrete scale
scale_alpha_ordinal | Alpha transparency scales
scale_color_binned | Continuous and binned colour scales
scale_color_brewer | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_color_continuous | Continuous and binned colour scales
scale_color_date | Gradient colour scales
scale_color_datetime | Gradient colour scales
scale_color_discrete | Discrete colour scales
scale_color_distiller | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_color_fermenter | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_color_gradient | Gradient colour scales
scale_color_gradient2 | Gradient colour scales
scale_color_gradientn | Gradient colour scales
scale_color_grey | Sequential grey colour scales
scale_color_hue | Evenly spaced colours for discrete data
scale_color_identity | Use values without scaling
scale_color_manual | Create your own discrete scale
scale_color_ordinal | Viridis colour scales from viridisLite
scale_color_steps | Binned gradient colour scales
scale_color_steps2 | Binned gradient colour scales
scale_color_stepsn | Binned gradient colour scales
scale_color_viridis_b | Viridis colour scales from viridisLite
scale_color_viridis_c | Viridis colour scales from viridisLite
scale_color_viridis_d | Viridis colour scales from viridisLite
scale_colour_binned | Continuous and binned colour scales
scale_colour_brewer | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_colour_continuous | Continuous and binned colour scales
scale_colour_date | Gradient colour scales
scale_colour_datetime | Gradient colour scales
scale_colour_discrete | Discrete colour scales
scale_colour_distiller | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_colour_fermenter | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_colour_gradient | Gradient colour scales
scale_colour_gradient2 | Gradient colour scales
scale_colour_gradientn | Gradient colour scales
scale_colour_grey | Sequential grey colour scales
scale_colour_hue | Evenly spaced colours for discrete data
scale_colour_identity | Use values without scaling
scale_colour_manual | Create your own discrete scale
scale_colour_ordinal | Viridis colour scales from viridisLite
scale_colour_steps | Binned gradient colour scales
scale_colour_steps2 | Binned gradient colour scales
scale_colour_stepsn | Binned gradient colour scales
scale_colour_viridis_b | Viridis colour scales from viridisLite
scale_colour_viridis_c | Viridis colour scales from viridisLite
scale_colour_viridis_d | Viridis colour scales from viridisLite
scale_continuous_identity | Use values without scaling
scale_discrete_identity | Use values without scaling
scale_discrete_manual | Create your own discrete scale
scale_fill_binned | Continuous and binned colour scales
scale_fill_brewer | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_fill_continuous | Continuous and binned colour scales
scale_fill_date | Gradient colour scales
scale_fill_datetime | Gradient colour scales
scale_fill_discrete | Discrete colour scales
scale_fill_distiller | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_fill_fermenter | Sequential, diverging and qualitative colour scales from ColorBrewer
scale_fill_gradient | Gradient colour scales
scale_fill_gradient2 | Gradient colour scales
scale_fill_gradientn | Gradient colour scales
scale_fill_grey | Sequential grey colour scales
scale_fill_hue | Evenly spaced colours for discrete data
scale_fill_identity | Use values without scaling
scale_fill_manual | Create your own discrete scale
scale_fill_ordinal | Viridis colour scales from viridisLite
scale_fill_steps | Binned gradient colour scales
scale_fill_steps2 | Binned gradient colour scales
scale_fill_stepsn | Binned gradient colour scales
scale_fill_viridis_b | Viridis colour scales from viridisLite
scale_fill_viridis_c | Viridis colour scales from viridisLite
scale_fill_viridis_d | Viridis colour scales from viridisLite
scale_linetype | Scale for line patterns
scale_linetype_binned | Scale for line patterns
scale_linetype_continuous | Scale for line patterns
scale_linetype_discrete | Scale for line patterns
scale_linetype_identity | Use values without scaling
scale_linetype_manual | Create your own discrete scale
scale_linewidth | Scales for line width
scale_linewidth_binned | Scales for line width
scale_linewidth_continuous | Scales for line width
scale_linewidth_date | Scales for line width
scale_linewidth_datetime | Scales for line width
scale_linewidth_discrete | Scales for line width
scale_linewidth_identity | Use values without scaling
scale_linewidth_manual | Create your own discrete scale
scale_linewidth_ordinal | Scales for line width
scale_radius | Scales for area or radius
scale_shape | Scales for shapes, aka glyphs
scale_shape_binned | Scales for shapes, aka glyphs
scale_shape_continuous | Scales for shapes, aka glyphs
scale_shape_discrete | Scales for shapes, aka glyphs
scale_shape_identity | Use values without scaling
scale_shape_manual | Create your own discrete scale
scale_shape_ordinal | Scales for shapes, aka glyphs
scale_size | Scales for area or radius
scale_size_area | Scales for area or radius
scale_size_binned | Scales for area or radius
scale_size_binned_area | Scales for area or radius
scale_size_continuous | Scales for area or radius
scale_size_date | Scales for area or radius
scale_size_datetime | Scales for area or radius
scale_size_discrete | Scales for area or radius
scale_size_identity | Use values without scaling
scale_size_manual | Create your own discrete scale
scale_size_ordinal | Scales for area or radius
scale_x_binned | Positional scales for binning continuous data (x & y)
scale_x_continuous | Position scales for continuous data (x & y)
scale_x_date | Position scales for date/time data
scale_x_datetime | Position scales for date/time data
scale_x_discrete | Position scales for discrete data
scale_x_log10 | Position scales for continuous data (x & y)
scale_x_reverse | Position scales for continuous data (x & y)
scale_x_sqrt | Position scales for continuous data (x & y)
scale_x_time | Position scales for date/time data
scale_y_binned | Positional scales for binning continuous data (x & y)
scale_y_continuous | Position scales for continuous data (x & y)
scale_y_date | Position scales for date/time data
scale_y_datetime | Position scales for date/time data
scale_y_discrete | Position scales for discrete data
scale_y_log10 | Position scales for continuous data (x & y)
scale_y_reverse | Position scales for continuous data (x & y)
scale_y_sqrt | Position scales for continuous data (x & y)
scale_y_time | Position scales for date/time data
seals | Vector field of seal movements
sec_axis | Specify a secondary axis
set_theme | Get, set, and modify the active theme
shape | Differentiation related aesthetics: linetype, size, shape
size | Differentiation related aesthetics: linetype, size, shape
stage | Control aesthetic evaluation
stat | Control aesthetic evaluation
StatSf | Visualise sf objects
StatSfCoordinates | Extract coordinates from 'sf' objects
stat_align | Ribbons and area plots
stat_bin | Histograms and frequency polygons
stat_bin2d | Heatmap of 2d bin counts
stat_binhex | Hexagonal heatmap of 2d bin counts
stat_bin_2d | Heatmap of 2d bin counts
stat_bin_hex | Hexagonal heatmap of 2d bin counts
stat_boxplot | A box and whiskers plot (in the style of Tukey)
stat_connect | Connect observations
stat_contour | 2D contours of a 3D surface
stat_contour_filled | 2D contours of a 3D surface
stat_count | Bar charts
stat_density | Smoothed density estimates
stat_density2d | Contours of a 2D density estimate
stat_density2d_filled | Contours of a 2D density estimate
stat_density_2d | Contours of a 2D density estimate
stat_density_2d_filled | Contours of a 2D density estimate
stat_ecdf | Compute empirical cumulative distribution
stat_ellipse | Compute normal data ellipses
stat_function | Draw a function as a continuous curve
stat_identity | Leave data as is
stat_manual | Manually compute transformations
stat_qq | A quantile-quantile plot
stat_qq_line | A quantile-quantile plot
stat_quantile | Quantile regression
stat_sf | Visualise sf objects
stat_sf_coordinates | Extract coordinates from 'sf' objects
stat_smooth | Smoothed conditional means
stat_spoke | Line segments parameterised by location, direction and distance
stat_sum | Count overlapping points
stat_summary | Summarise y values at unique/binned x
stat_summary2d | Bin and summarise in 2d (rectangle & hexagons)
stat_summary_2d | Bin and summarise in 2d (rectangle & hexagons)
stat_summary_bin | Summarise y values at unique/binned x
stat_summary_hex | Bin and summarise in 2d (rectangle & hexagons)
stat_unique | Remove duplicates
stat_ydensity | Violin plot
subtheme | Shortcuts for theme settings

## -- T --

theme | Modify components of a theme
theme_bw | Complete themes
theme_classic | Complete themes
theme_dark | Complete themes
theme_get | Get, set, and modify the active theme
theme_gray | Complete themes
theme_grey | Complete themes
theme_light | Complete themes
theme_linedraw | Complete themes
theme_minimal | Complete themes
theme_replace | Get, set, and modify the active theme
theme_set | Get, set, and modify the active theme
theme_sub_axis | Shortcuts for theme settings
theme_sub_axis_bottom | Shortcuts for theme settings
theme_sub_axis_left | Shortcuts for theme settings
theme_sub_axis_right | Shortcuts for theme settings
theme_sub_axis_top | Shortcuts for theme settings
theme_sub_axis_x | Shortcuts for theme settings
theme_sub_axis_y | Shortcuts for theme settings
theme_sub_legend | Shortcuts for theme settings
theme_sub_panel | Shortcuts for theme settings
theme_sub_plot | Shortcuts for theme settings
theme_sub_strip | Shortcuts for theme settings
theme_test | Complete themes
theme_update | Get, set, and modify the active theme
theme_void | Complete themes
txhousing | Housing sales in TX

## -- U --

update_theme | Get, set, and modify the active theme

## -- V --

vars | Quote faceting variables

## -- X --

x | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
xend | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
xlab | Modify axis, legend, and plot labels
xlim | Set scale limits
xmax | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
xmin | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend

## -- Y --

y | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
yend | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
ylab | Modify axis, legend, and plot labels
ylim | Set scale limits
ymax | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
ymin | Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend

## -- misc --

%+% | Add components to a plot
%+replace% | Get, set, and modify the active theme
+.gg | Add components to a plot