Package: ggplot2 3.5.1.9000

Thomas Lin Pedersen

ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics

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 care of the details.

Authors:Hadley Wickham [aut], Winston Chang [aut], Lionel Henry [aut], Thomas Lin Pedersen [aut, cre], Kohske Takahashi [aut], Claus Wilke [aut], Kara Woo [aut], Hiroaki Yutani [aut], Dewey Dunnington [aut], Teun van den Brand [aut], Posit, PBC [cph, fnd]

ggplot2_3.5.1.9000.tar.gz
ggplot2_3.5.1.9000.zip(r-4.5)ggplot2_3.5.1.9000.zip(r-4.4)ggplot2_3.5.1.9000.zip(r-4.3)
ggplot2_3.5.1.9000.tgz(r-4.4-any)ggplot2_3.5.1.9000.tgz(r-4.3-any)
ggplot2_3.5.1.9000.tar.gz(r-4.5-noble)ggplot2_3.5.1.9000.tar.gz(r-4.4-noble)
ggplot2_3.5.1.9000.tgz(r-4.4-emscripten)ggplot2_3.5.1.9000.tgz(r-4.3-emscripten)
ggplot2.pdf |ggplot2.html
ggplot2/json (API)
NEWS

# Install 'ggplot2' in R:
install.packages('ggplot2', repos = c('https://tidyverse.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/tidyverse/ggplot2/issues

Datasets:
  • diamonds - Prices of over 50,000 round cut diamonds
  • economics - US economic time series
  • economics_long - US economic time series
  • faithfuld - 2d density estimate of Old Faithful data
  • luv_colours - 'colors()' in Luv space
  • 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
  • presidential - Terms of 12 presidents from Eisenhower to Trump
  • seals - Vector field of seal movements
  • txhousing - Housing sales in TX

On CRAN:

data-visualisationvisualisation

25.03 score 6.5k stars 7.3k packages 604k scripts 1.8M downloads 11k mentions 592 exports 16 dependencies

Last updated 8 hours agofrom:f46805349d. Checks:OK: 1 NOTE: 6. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 13 2024
R-4.5-winNOTENov 13 2024
R-4.5-linuxNOTENov 13 2024
R-4.4-winNOTENov 13 2024
R-4.4-macNOTENov 13 2024
R-4.3-winNOTENov 13 2024
R-4.3-macNOTENov 13 2024

Exports:.data.expose_data.ignore_data.pt.stroke%+%%+replace%aesaes_aes_allaes_autoaes_qaes_stringafter_scaleafter_statalphaannotateannotation_customannotation_logticksannotation_mapannotation_rasterarrowas_labelas_labellerautolayerautoplotAxisSecondarybenchplotbinned_scaleborderscalc_elementcheck_devicecombine_varscomplete_themecontinuous_scaleCoordcoord_cartesiancoord_equalcoord_fixedcoord_flipcoord_mapcoord_munchcoord_polarcoord_quickmapcoord_radialcoord_sfcoord_transCoordCartesianCoordFixedCoordFlipCoordMapCoordPolarCoordQuickmapCoordRadialCoordSfCoordTranscut_intervalcut_numbercut_widthdatetime_scalederivediscrete_scaledraw_key_ablinedraw_key_blankdraw_key_boxplotdraw_key_crossbardraw_key_dotplotdraw_key_labeldraw_key_linerangedraw_key_pathdraw_key_pointdraw_key_pointrangedraw_key_polygondraw_key_rectdraw_key_smoothdraw_key_textdraw_key_timeseriesdraw_key_vlinedraw_key_vpathdup_axisel_defelement_blankelement_geomelement_grobelement_lineelement_rectelement_renderelement_textenexprenexprsenquoenquosensymensymsexpand_limitsexpand_scaleexpansionexprFacetfacet_gridfacet_nullfacet_wrapFacetGridFacetNullFacetWrapfill_alphafind_panelflip_dataflipped_namesfortifyfrom_themeGeomgeom_ablinegeom_areageom_bargeom_bin_2dgeom_bin2dgeom_blankgeom_boxplotgeom_colgeom_contourgeom_contour_filledgeom_countgeom_crossbargeom_curvegeom_densitygeom_density_2dgeom_density_2d_filledgeom_density2dgeom_density2d_filledgeom_dotplotgeom_errorbargeom_errorbarhgeom_freqpolygeom_functiongeom_hexgeom_histogramgeom_hlinegeom_jittergeom_labelgeom_linegeom_linerangegeom_mapgeom_pathgeom_pointgeom_pointrangegeom_polygongeom_qqgeom_qq_linegeom_quantilegeom_rastergeom_rectgeom_ribbongeom_ruggeom_segmentgeom_sfgeom_sf_labelgeom_sf_textgeom_smoothgeom_spokegeom_stepgeom_textgeom_tilegeom_violingeom_vlineGeomAblineGeomAnnotationMapGeomAreaGeomBarGeomBlankGeomBoxplotGeomColGeomContourGeomContourFilledGeomCrossbarGeomCurveGeomCustomAnnGeomDensityGeomDensity2dGeomDensity2dFilledGeomDotplotGeomErrorbarGeomErrorbarhGeomFunctionGeomHexGeomHlineGeomLabelGeomLineGeomLinerangeGeomLogticksGeomMapGeomPathGeomPointGeomPointrangeGeomPolygonGeomQuantileGeomRasterGeomRasterAnnGeomRectGeomRibbonGeomRugGeomSegmentGeomSfGeomSmoothGeomSpokeGeomStepGeomTextGeomTileGeomViolinGeomVlineget_alt_textget_element_treeget_geom_defaultsget_guide_dataget_labsget_last_plotget_layer_dataget_layer_grobget_panel_scalesget_strip_labelsget_themegg_depgg_parggplotggplot_addggplot_buildggplot_gtableggplotGrobggprotoggproto_parentggsaveggtitleGuideguide_axisguide_axis_logticksguide_axis_stackguide_axis_thetaguide_binsguide_colorbarguide_colorstepsguide_colourbarguide_colourstepsguide_customguide_gengrobguide_geomguide_legendguide_mergeguide_noneguide_trainguide_transformGuideAxisGuideAxisLogticksGuideAxisStackGuideAxisThetaGuideBinsGuideColourbarGuideColourstepsGuideCustomGuideLegendGuideNoneGuideOldguideshas_flipped_aesis.coordis.Coordis.facetis.geomis.ggplotis.ggprotois.guideis.guidesis.layeris.mappingis.marginis.positionis.scaleis.statis.themeis.theme_elementis.waiverlabel_bothlabel_bquotelabel_contextlabel_parsedlabel_valuelabel_wrap_genlabellerlabslast_plotlayerlayer_datalayer_groblayer_scaleslayer_sfLayoutlimsmap_datamarginmax_heightmax_widthmean_cl_bootmean_cl_normalmean_sdlmean_semedian_hilowmerge_elementnew_guideold_guidepanel_colspanel_rowspattern_alphaPositionposition_dodgeposition_dodge2position_fillposition_identityposition_jitterposition_jitterdodgeposition_nudgeposition_stackPositionDodgePositionDodge2PositionFillPositionIdentityPositionJitterPositionJitterdodgePositionNudgePositionStackqplotquickplotquoquo_namequosregister_theme_elementsrelremove_missingrender_axesrender_stripsreplace_themereset_geom_defaultsreset_stat_defaultsreset_theme_settingsresolutionScalescale_alphascale_alpha_binnedscale_alpha_continuousscale_alpha_datescale_alpha_datetimescale_alpha_discretescale_alpha_identityscale_alpha_manualscale_alpha_ordinalscale_color_binnedscale_color_brewerscale_color_continuousscale_color_datescale_color_datetimescale_color_discretescale_color_distillerscale_color_fermenterscale_color_gradientscale_color_gradient2scale_color_gradientnscale_color_greyscale_color_huescale_color_identityscale_color_manualscale_color_ordinalscale_color_stepsscale_color_steps2scale_color_stepsnscale_color_viridis_bscale_color_viridis_cscale_color_viridis_dscale_colour_binnedscale_colour_brewerscale_colour_continuousscale_colour_datescale_colour_datetimescale_colour_discretescale_colour_distillerscale_colour_fermenterscale_colour_gradientscale_colour_gradient2scale_colour_gradientnscale_colour_greyscale_colour_huescale_colour_identityscale_colour_manualscale_colour_ordinalscale_colour_stepsscale_colour_steps2scale_colour_stepsnscale_colour_viridis_bscale_colour_viridis_cscale_colour_viridis_dscale_continuous_identityscale_discrete_identityscale_discrete_manualscale_fill_binnedscale_fill_brewerscale_fill_continuousscale_fill_datescale_fill_datetimescale_fill_discretescale_fill_distillerscale_fill_fermenterscale_fill_gradientscale_fill_gradient2scale_fill_gradientnscale_fill_greyscale_fill_huescale_fill_identityscale_fill_manualscale_fill_ordinalscale_fill_stepsscale_fill_steps2scale_fill_stepsnscale_fill_viridis_bscale_fill_viridis_cscale_fill_viridis_dscale_linetypescale_linetype_binnedscale_linetype_continuousscale_linetype_discretescale_linetype_identityscale_linetype_manualscale_linewidthscale_linewidth_binnedscale_linewidth_continuousscale_linewidth_datescale_linewidth_datetimescale_linewidth_discretescale_linewidth_identityscale_linewidth_manualscale_linewidth_ordinalscale_radiusscale_shapescale_shape_binnedscale_shape_continuousscale_shape_discretescale_shape_identityscale_shape_manualscale_shape_ordinalscale_sizescale_size_areascale_size_binnedscale_size_binned_areascale_size_continuousscale_size_datescale_size_datetimescale_size_discretescale_size_identityscale_size_manualscale_size_ordinalscale_typescale_x_binnedscale_x_continuousscale_x_datescale_x_datetimescale_x_discretescale_x_log10scale_x_reversescale_x_sqrtscale_x_timescale_y_binnedscale_y_continuousscale_y_datescale_y_datetimescale_y_discretescale_y_log10scale_y_reversescale_y_sqrtscale_y_timeScaleBinnedScaleBinnedPositionScaleContinuousScaleContinuousDateScaleContinuousDatetimeScaleContinuousIdentityScaleContinuousPositionScaleDiscreteScaleDiscreteIdentityScaleDiscretePositionsec_axisset_last_plotset_themesf_transform_xyshould_stopstagestandardise_aes_namesstatStatstat_alignstat_binstat_bin_2dstat_bin_hexstat_bin2dstat_binhexstat_boxplotstat_contourstat_contour_filledstat_countstat_densitystat_density_2dstat_density_2d_filledstat_density2dstat_density2d_filledstat_ecdfstat_ellipsestat_functionstat_identitystat_qqstat_qq_linestat_quantilestat_sfstat_sf_coordinatesstat_smoothstat_spokestat_sumstat_summarystat_summary_2dstat_summary_binstat_summary_hexstat_summary2dstat_uniquestat_ydensityStatAlignStatBinStatBin2dStatBindotStatBinhexStatBoxplotStatContourStatContourFilledStatCountStatDensityStatDensity2dStatDensity2dFilledStatEcdfStatEllipseStatFunctionStatIdentityStatQqStatQqLineStatQuantileStatSfStatSfCoordinatesStatSmoothStatSumStatSummaryStatSummary2dStatSummaryBinStatSummaryHexStatUniqueStatYdensitysummarise_coordsummarise_layerssummarise_layoutsymsymsthemetheme_bwtheme_classictheme_darktheme_gettheme_graytheme_greytheme_lighttheme_linedrawtheme_minimaltheme_replacetheme_settheme_testtheme_updatetheme_voidtransform_positiontranslate_shape_stringunitupdate_geom_defaultsupdate_labelsupdate_stat_defaultsupdate_themevarswaiverwrap_dimsxlabxlimylabylimzeroGrob

Dependencies:clicolorspacefarvergluegtableisobandlabelinglifecyclemunsellR6RColorBrewerrlangscalesvctrsviridisLitewithr

Aesthetic specifications

Rendered fromggplot2-specs.Rmdusingknitr::rmarkdownon Nov 13 2024.

Last update: 2024-10-30
Started: 2015-08-14

Extending ggplot2

Rendered fromextending-ggplot2.Rmdusingknitr::rmarkdownon Nov 13 2024.

Last update: 2024-10-30
Started: 2015-08-05

Introduction to ggplot2

Rendered fromggplot2.Rmdusingknitr::rmarkdownon Nov 13 2024.

Last update: 2024-10-30
Started: 2023-09-11

Using ggplot2 in packages

Rendered fromggplot2-in-packages.Rmdusingknitr::rmarkdownon Nov 13 2024.

Last update: 2024-10-30
Started: 2019-06-04

Readme and manuals

Help Manual

Help pageTopics
Add components to a plot%+% +.gg
Construct aesthetic mappingsaes
Colour related aesthetics: colour, fill, and alphaaes_colour_fill_alpha color colour fill
Control aesthetic evaluationaes_eval after_scale after_stat from_theme stage stat
Aesthetics: groupingaes_group_order group
Differentiation related aesthetics: linetype, size, shapeaes_linetype_size_shape linetype shape size
Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yendaes_position x xend xmax xmin y yend ymax ymin
Create an annotation layerannotate
Annotation: Custom grobannotation_custom
Annotation: log tick marksannotation_logticks
Annotation: a mapannotation_map
Annotation: high-performance rectangular tilingannotation_raster
Create a ggplot layer appropriate to a particular data typeautolayer
Tailoring plots to particular data typesautomatic_plotting
Create a complete ggplot appropriate to a particular data typeautoplot
Create a layer of map bordersborders
Cartesian coordinatescoord_cartesian
Cartesian coordinates with fixed "aspect ratio"coord_equal coord_fixed
Cartesian coordinates with x and y flippedcoord_flip
Map projectionscoord_map coord_quickmap
Polar coordinatescoord_polar coord_radial
Transformed Cartesian coordinate systemcoord_trans
Visualise sf objectsCoordSf coord_sf GeomSf geom_sf geom_sf_label geom_sf_text ggsf StatSf stat_sf
Discretise numeric data into categoricalcut_interval cut_number cut_width
Prices of over 50,000 round cut diamondsdiamonds
Key glyphs for legendsdraw_key draw_key_abline draw_key_blank draw_key_boxplot draw_key_crossbar draw_key_dotplot draw_key_label draw_key_linerange draw_key_path draw_key_point draw_key_pointrange draw_key_polygon draw_key_rect draw_key_smooth draw_key_text draw_key_timeseries draw_key_vline draw_key_vpath
US economic time serieseconomics economics_long
Theme elementselement_blank element_geom element_line element_rect element_text margin rel
Expand the plot limits, using dataexpand_limits
Generate expansion vector for scalesexpand_scale expansion
Lay out panels in a gridfacet_grid
Wrap a 1d ribbon of panels into 2dfacet_wrap
2d density estimate of Old Faithful datafaithfuld
Fortify a model with data.fortify
Reference lines: horizontal, vertical, and diagonalgeom_abline geom_hline geom_vline
Bar chartsgeom_bar geom_col stat_count
Heatmap of 2d bin countsgeom_bin2d geom_bin_2d stat_bin2d stat_bin_2d
Draw nothinggeom_blank
A box and whiskers plot (in the style of Tukey)geom_boxplot stat_boxplot
2D contours of a 3D surfacegeom_contour geom_contour_filled stat_contour stat_contour_filled
Count overlapping pointsgeom_count stat_sum
Vertical intervals: lines, crossbars & errorbarsgeom_crossbar geom_errorbar geom_errorbarh geom_linerange geom_pointrange
Smoothed density estimatesgeom_density stat_density
Contours of a 2D density estimategeom_density2d geom_density2d_filled geom_density_2d geom_density_2d_filled stat_density2d stat_density2d_filled stat_density_2d stat_density_2d_filled
Dot plotgeom_dotplot
Histograms and frequency polygonsgeom_freqpoly geom_histogram stat_bin
Draw a function as a continuous curvegeom_function stat_function
Hexagonal heatmap of 2d bin countsgeom_hex stat_binhex stat_bin_hex
Jittered pointsgeom_jitter
Textgeom_label geom_text
Polygons from a reference mapgeom_map
Connect observationsgeom_line geom_path geom_step
Pointsgeom_point
Polygonsgeom_polygon
A quantile-quantile plotgeom_qq geom_qq_line stat_qq stat_qq_line
Quantile regressiongeom_quantile stat_quantile
Rectanglesgeom_raster geom_rect geom_tile
Ribbons and area plotsgeom_area geom_ribbon stat_align
Rug plots in the marginsgeom_rug
Line segments and curvesgeom_curve geom_segment
Smoothed conditional meansgeom_smooth stat_smooth
Line segments parameterised by location, direction and distancegeom_spoke stat_spoke
Violin plotgeom_violin stat_ydensity
Extract alt text from a plotalt_text get_alt_text
Get, set, and modify the active theme%+replace% get_theme replace_theme set_theme theme_get theme_replace theme_set theme_update update_theme
Create a new ggplotggplot
Create a new ggproto objectggproto ggproto_parent
Save a ggplot (or other grid object) with sensible defaultsggsave
Complete themestheme_bw theme_classic theme_dark theme_gray theme_grey theme_light theme_linedraw theme_minimal theme_test theme_void
Axis guideguide_axis
Axis with logarithmic tick marksguide_axis_logticks
Stacked axis guidesguide_axis_stack
Angle axis guideguide_axis_theta
A binned version of guide_legendguide_bins
Continuous colour bar guideguide_colorbar guide_colourbar
Discretized colourbar guideguide_colorsteps guide_coloursteps
Custom guidesguide_custom
Legend guideguide_legend
Empty guideguide_none
Set guides for each scaleguides
A selection of summary functions from Hmischmisc mean_cl_boot mean_cl_normal mean_sdl median_hilow
Label with mathematical expressionslabel_bquote
Construct labelling specificationlabeller
Useful labeller functionslabellers label_both label_context label_parsed label_value label_wrap_gen
Modify axis, legend, and plot labelsget_labs ggtitle labs xlab ylab
Layer geometry displaylayer_geoms
Layer position adjustmentslayer_positions
Layer statistical transformationslayer_stats
Set scale limitslims xlim ylim
'colors()' in Luv spaceluv_colours
Calculate mean and standard error of the meanmean_se
Midwest demographicsmidwest
Fuel economy data from 1999 to 2008 for 38 popular models of carsmpg
An updated and expanded version of the mammals sleep datasetmsleep
Dodge overlapping objects side-to-sideposition_dodge position_dodge2
Don't adjust positionposition_identity
Jitter points to avoid overplottingposition_jitter
Simultaneously dodge and jitterposition_jitterdodge
Nudge points a fixed distanceposition_nudge
Stack overlapping objects on top of each anotherposition_fill position_stack
Terms of 12 presidents from Eisenhower to Trumppresidential
Explicitly draw plotplot.ggplot print.ggplot
Format or print a ggproto objectformat.ggproto print.ggproto
Quick plotqplot quickplot
Compute the "resolution" of a numeric vectorresolution
Alpha transparency scalesscale_alpha scale_alpha_binned scale_alpha_continuous scale_alpha_date scale_alpha_datetime scale_alpha_discrete scale_alpha_ordinal
Positional scales for binning continuous data (x & y)scale_x_binned scale_y_binned
Sequential, diverging and qualitative colour scales from ColorBrewerscale_color_brewer scale_color_distiller scale_color_fermenter scale_colour_brewer scale_colour_distiller scale_colour_fermenter scale_fill_brewer scale_fill_distiller scale_fill_fermenter
Continuous and binned colour scalesscale_color_binned scale_color_continuous scale_colour_binned scale_colour_continuous scale_fill_binned scale_fill_continuous
Discrete colour scalesscale_color_discrete scale_colour_discrete scale_fill_discrete
Gradient colour scalesscale_color_date scale_color_datetime scale_color_gradient scale_color_gradient2 scale_color_gradientn scale_colour_date scale_colour_datetime scale_colour_gradient scale_colour_gradient2 scale_colour_gradientn scale_fill_date scale_fill_datetime scale_fill_gradient scale_fill_gradient2 scale_fill_gradientn
Sequential grey colour scalesscale_color_grey scale_colour_grey scale_fill_grey
Evenly spaced colours for discrete datascale_color_hue scale_colour_hue scale_fill_hue
Binned gradient colour scalesscale_color_steps scale_color_steps2 scale_color_stepsn scale_colour_steps scale_colour_steps2 scale_colour_stepsn scale_fill_steps scale_fill_steps2 scale_fill_stepsn
Viridis colour scales from viridisLitescale_color_ordinal scale_color_viridis_b scale_color_viridis_c scale_color_viridis_d scale_colour_ordinal scale_colour_viridis_b scale_colour_viridis_c scale_colour_viridis_d scale_fill_ordinal scale_fill_viridis_b scale_fill_viridis_c scale_fill_viridis_d
Position scales for continuous data (x & y)scale_x_continuous scale_x_log10 scale_x_reverse scale_x_sqrt scale_y_continuous scale_y_log10 scale_y_reverse scale_y_sqrt
Position scales for date/time datascale_x_date scale_x_datetime scale_x_time scale_y_date scale_y_datetime scale_y_time
Use values without scalingscale_alpha_identity scale_color_identity scale_colour_identity scale_continuous_identity scale_discrete_identity scale_fill_identity scale_linetype_identity scale_linewidth_identity scale_shape_identity scale_size_identity
Scale for line patternsscale_linetype scale_linetype_binned scale_linetype_continuous scale_linetype_discrete
Scales for line widthscale_linewidth scale_linewidth_binned scale_linewidth_continuous scale_linewidth_date scale_linewidth_datetime scale_linewidth_discrete scale_linewidth_ordinal
Create your own discrete scalescale_alpha_manual scale_color_manual scale_colour_manual scale_discrete_manual scale_fill_manual scale_linetype_manual scale_linewidth_manual scale_shape_manual scale_size_manual
Scales for shapes, aka glyphsscale_shape scale_shape_binned scale_shape_continuous scale_shape_discrete scale_shape_ordinal
Scales for area or radiusscale_radius scale_size scale_size_area scale_size_binned scale_size_binned_area scale_size_continuous scale_size_date scale_size_datetime scale_size_discrete scale_size_ordinal
Position scales for discrete datascale_x_discrete scale_y_discrete
Vector field of seal movementsseals
Specify a secondary axisderive dup_axis sec_axis
Compute empirical cumulative distributionstat_ecdf
Compute normal data ellipsesstat_ellipse
Leave data as isstat_identity
Extract coordinates from 'sf' objectsStatSfCoordinates stat_sf_coordinates
Bin and summarise in 2d (rectangle & hexagons)stat_summary2d stat_summary_2d stat_summary_hex
Summarise y values at unique/binned xstat_summary stat_summary_bin
Remove duplicatesstat_unique
Modify components of a themetheme
Housing sales in TXtxhousing
Quote faceting variablesvars