Help topics


Geoms, short for geometric objects, describe the type of plot you will produce.


It's often useful to transform your data before plotting, and that's what statistical transformations do.


Scales control the mapping between data and aesthetics.

  • expand_limits
    Expand the plot limits with data.
  • guides
    Set guides for each scale.
  • guide_legend
    Legend guide.
  • guide_colourbar(guide_colorbar)
    Contiuous colour bar guide.
  • scale_alpha(scale_alpha_continuous, scale_alpha_discrete)
    Alpha scales.
  • scale_area
    Scale area instead of radius (for size).
  • scale_colour_brewer(scale_color_brewer, scale_fill_brewer)
    Sequential, diverging and qualitative colour scales from
  • scale_colour_gradient(scale_color_continuous, scale_color_gradient, scale_colour_continuous, scale_fill_continuous, scale_fill_gradient)
    Smooth gradient between two colours
  • scale_colour_gradient2(scale_color_gradient2, scale_fill_gradient2)
    Diverging colour gradient
  • scale_colour_gradientn(scale_color_gradientn, scale_fill_gradientn)
    Smooth colour gradient between n colours
  • scale_colour_grey(scale_color_grey, scale_fill_grey)
    Sequential grey colour scale.
  • scale_colour_hue(scale_color_discrete, scale_color_hue, scale_colour_discrete, scale_fill_discrete, scale_fill_hue)
    Qualitative colour scale with evenly spaced hues.
  • scale_identity(scale_alpha_identity, scale_color_identity, scale_colour_identity, scale_fill_identity, scale_linetype_identity, scale_shape_identity, scale_size_identity)
    Use values without scaling.
  • scale_manual(scale_alpha_manual, scale_color_manual, scale_colour_manual, scale_fill_manual, scale_linetype_manual, scale_shape_manual, scale_size_manual)
    Create your own discrete scale.
  • scale_linetype(scale_linetype_continuous, scale_linetype_discrete)
    Scale for line patterns.
  • scale_shape(scale_shape_continuous, scale_shape_discrete)
    Scale for shapes, aka glyphs.
  • scale_size(scale_size_continuous, scale_size_discrete)
    Size scale.
  • scale_x_continuous(scale_x_log10, scale_x_reverse, scale_x_sqrt, scale_y_continuous, scale_y_log10, scale_y_reverse, scale_y_sqrt)
    Continuous position scales (x & y).
  • scale_x_date(scale_y_date)
    Position scale, date
  • scale_x_datetime(scale_y_datetime)
    Position scale, date
  • scale_x_discrete(scale_y_discrete)
    Discrete position.
  • labs(ggtitle, xlab, ylab)
    Change axis labels and legend titles
  • update_labels
    Update axis/legend labels
  • xlim(ylim)
    Convenience functions to set the limits of the x and y axis.

Coordinate systems

Coordinate systems adjust the mapping from coordinates to the 2d plane of the computer screen.


Facets display subsets of the dataset in different panels.

Position adjustments

Position adjustments can be used to fine tune positioning of objects to achieve effects like dodging, jittering and stacking.


Data sets included in ggplot2 and used in examples

  • diamonds
    Prices of 50,000 round cut diamonds
  • economics
    US economic time series.
  • midwest
    Midwest demographics.
  • movies
    Movie information and user ratings from
  • mpg
    Fuel economy data from 1999 and 2008 for 38 popular models of car
  • msleep
    An updated and expanded version of the mammals sleep dataset.
  • presidential
    Terms of 10 presidents from Eisenhower to Bush W.
  • seals
    Vector field of seal movements.


Specialised functions for adding annotations to a plot


Fortify methods make it possible to use ggplot2 with objects of various types, not just data frames.

  • fortify
    Fortify a model with data.
  • fortify-multcomp(fortify.cld, fortify.confint.glht, fortify.glht, fortify.summary.glht)
    Fortify methods for objects produced by
  • fortify.lm
    Supplement the data fitted to a linear model with model fit statistics.
    Fortify method for map objects.
  • fortify.sp(fortify.Line, fortify.Lines, fortify.Polygon, fortify.Polygons, fortify.SpatialLinesDataFrame, fortify.SpatialPolygons, fortify.SpatialPolygonsDataFrame)
    Fortify method for classes from the sp package.
  • map_data
    Create a data frame of map data.


Themes control non-data components of the plot

  • add_theme
    Modify properties of an element in a theme object
  • calc_element
    Calculate the element properties, by inheriting properties from its parents
  • element_blank
    Theme element: blank.
  • element_line
    Theme element: line.
  • element_rect
    Theme element: rectangle.
  • element_text
    Theme element: text.
  • is.rel
    Reports whether x is a rel object
  • is.theme
    Reports whether x is a theme object
  • opts
    Build a theme (or partial theme) from theme elements
  • rel
    Relative sizing for theme elements
  • theme
    Set theme elements
  • theme_bw
    A theme with white background and black gridlines.
  • theme_grey(theme_gray)
    A theme with grey background and white gridlines.
  • theme_update(theme_get, theme_set)
    Get, set and update themes.
  • update_element
    Update theme param

Plot creation

  • ggplot
    Create a new ggplot plot
  • qplot(quickplot)
    Quick plot
  •, %+replace%)
    Modify a ggplot or theme object by adding on new components.
  • autoplot
    Create a complete ggplot appropriate to a particular data type
    Create a new ggplot plot from a data frame
  • is.ggplot
    Reports whether x is a ggplot object
  • print.ggplot(plot.ggplot)
    Draw plot on current graphics device.


  • aes
    Generate aesthetic mappings that describe how variables in the data are
  • aes_all
    Given a character vector, create a set of identity mappings
  • aes_auto
    Automatic aesthetic mapping
  • aes_string
    Generate aesthetic mappings from a string
  • aes_colour_fill_alpha(alpha, color, colour, fill)
    Colour related aesthetics: colour, fill and alpha
  • aes_group_order(group, order)
    Aesthetics: group, order
  • aes_linetype_size_shape(linetype, shape, size)
    Differentiation related aesthetics: linetype, size, shape
  • aes_position(x, xend, xmax, xmin, y, yend, ymax, ymin)
    Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend


  • cut_interval
    Cut numeric vector into intervals of equal length.
  • cut_number
    Cut numeric vector into intervals containing equal number of points.
  • discrete_scale
    Discrete scale constructor.
  • gg_dep
    Give a deprecation error, warning, or messsage, depending on version number.
  • ggfluctuation
    Create a fluctuation plot.
  • ggmissing
    Create a plot to illustrate patterns of missing values.
  • ggorder
    A plot to investigate the order in which observations were recorded.
  • ggpcp
    Make a parallel coordinates plot.
  • ggplot2(ggplot2-package)
  • ggsave
    Save a ggplot with sensible defaults
  • ggscale
    Components of a scale:
  • ggstructure
    A plot which aims to reveal gross structural anomalies in the data.
  • hmisc(mean_cl_boot, mean_cl_normal, mean_sdl, median_hilow)
    Wrap up a selection of summary functions from Hmisc to make it easy to use
  • last_plot
    Retrieve the last plot to be modified or created.
  • mean_se
    Calculate mean and standard errors on either side.
  • plotmatrix
    Code to create a scatterplot matrix (experimental)
  • resolution
    Compute the "resolution" of a data vector.
  • scale_size_area
    Scale area instead of radius, for size.
  • theme_blank(theme_line, theme_rect, theme_segment, theme_text)
    Deprecated theme_xx functions
  • theme_classic
    A classic-looking theme, with x and y axis lines and no gridlines.
  • theme_minimal
    A minimalistic theme with no background annotations.
  • translate_qplot_base
    Translating between qplot and base graphics
  • translate_qplot_ggplot
    Translating between qplot and ggplot
  • translate_qplot_gpl
    Translating between qplot and Graphics Production Library (GPL)
  • translate_qplot_lattice
    Translating between qplot and lattice
  • update_geom_defaults(update_stat_defaults)
    Modify geom/stat aesthetic defaults for future plots


  • Depends: stats, methods
  • Imports: plyr, digest, grid, gtable, reshape2, scales, proto, MASS
  • Suggests: quantreg, Hmisc, mapproj, maps, hexbin, maptools, multcomp, nlme, testthat
  • Extends: