ggplot2

R 패키지 메타데이터와 수집 신호를 모아 봅니다.

Packages / CRAN / ggplot2

ggplot2

v4.0.3
Repository CRANLicense MIT + file LICENSELifecycle activeNeeds compilation no
DOI
10.32614/CRAN.package.ggplot2
Task views
Analysis of Spatial Data, Chemometrics and Computational Physics, Network Analysis, Phylogenetics, Teaching Statistics
Reverse imports
164,969
Reverse depends
15,350

Core Signals

첫 화면에서 판단해야 할 수집 신호를 먼저 배치합니다.

3
Task views
Analysis of Spatial Data, Chemometrics and Computational Physics, Network Analysis 외 2
Reverse imports
164,969
Reverse depends
15,350

Supported Backends

DESCRIPTION에서 감지한 backend 관련 package입니다.

0
backend package 신호가 없습니다.

Quick Facts

기본 메타데이터를 작은 카드와 토큰으로 압축합니다.

profile
Repository
CRAN
Version
4.0.3
License
MIT + file LICENSE
Lifecycle
active
Needs compilation
no
Reverse depends
15,350
Reverse imports
164,969
Last observed
2026-05-30
CRAN
cran.r-project.org/package=ggplot2

Build fields

Enhances
1
sp

수집 소스별 패키지 정보

2개 소스
CRAN
4.0.3
2026-05-30
License
MIT + file LICENSE
Depends
R (>= 4.1)
Imports
cli, grDevices, grid, gtable (>= 0.3.6), isoband, lifecycle (> 1.0.1), rlang (>= 1.1.0), S7, scales (>= 1.4.0), stats, vctrs (>= 0.6.0), withr (>= 2.5.0)
Suggests
broom, covr, dplyr, ggplot2movies, hexbin, Hmisc, hms, knitr, mapproj, maps, MASS, mgcv, multcomp, munsell, nlme, profvis, quantreg, quarto, ragg (>= 1.2.6), RColorBrewer, roxygen2, rpart, sf (>= 0.7-3), svglite (>= 2.1.2), testthat (>= 3.1.5), tibble, vdiffr (>= 1.0.6), xml2
Enhances
sp
Needs compilation
no
Reverse depends
15,350
Reverse imports
164,969
Lifecycle
active
Last observed
2026-05-30 10:45:11
R-universe
4.0.3.9000
2026-05-30
Depends
R
Imports
cli, grDevices, grid, gtable, isoband, lifecycle, rlang, S7, scales, stats, vctrs, withr
Suggests
broom, covr, dplyr, ggplot2movies, hexbin, Hmisc, hms, knitr, mapproj, maps, MASS, mgcv, multcomp, munsell, nlme, profvis, quantreg, quarto, ragg, RColorBrewer, roxygen2, rpart, sf, svglite, testthat, tibble, vdiffr, xml2
Enhances
sp
Last observed
2026-05-30 11:26:48

이 패키지가 의존하는 패키지

5개 표시전체 41개
PackageTypeSpec
cli
CRAN · 4.0.3 · 2026-05-30
Importscli
grDevices
CRAN · 4.0.3 · 2026-05-30
ImportsgrDevices
grid
CRAN · 4.0.3 · 2026-05-30
Importsgrid
gtable
CRAN · 4.0.3 · 2026-05-30
Importsgtable (>= 0.3.6)
isoband
CRAN · 4.0.3 · 2026-05-30
Importsisoband
1 / 9

이 패키지를 쓰는 패키지

5개 표시전체 120개
PackageTypeSpec
accessrmd
1.0.0
CRAN · 2026-05-30
Dependsggplot2
AFheritability
0.1.0
CRAN · 2026-05-08
Dependsggplot2
afmToolkit
1.0.0
CRAN · 2026-05-30
Dependsggplot2
alakazam
1.4.3
CRAN · 2026-05-30
Dependsggplot2 (>= 3.4.0)
alookr
0.5.1
CRAN · 2026-05-30
Dependsggplot2 (>= 3.0.0)
1 / 24

Reverse dependency summary

4 types
TypePackages
Depends397
Imports4,236
Suggests1,905
Enhances6

패키지 페이지

Reverse depends
942
Reverse imports
9,916
Reverse suggests
4,142
Reverse enhances
14
All links
7,582
Repository
CRAN
Version
4.0.3
Collected
2026-05-25 06:18:12
Package page
https://cran.r-project.org/web/packages/ggplot2/index.html
DOI
10.32614/CRAN.package.ggplot2
Citation
https://cran.r-project.org/web/packages/ggplot2/citation.html
CRAN checks
https://cran.r-project.org/web/checks/check_results_ggplot2.html
README
https://cran.r-project.org/web/packages/ggplot2/readme/README.html
NEWS
https://cran.r-project.org/web/packages/ggplot2/news/news.html
Reference HTML
https://cran.r-project.org/web/packages/ggplot2/refman/ggplot2.html
Reference PDF
https://cran.r-project.org/web/packages/ggplot2/ggplot2.pdf
Source package
https://cran.r-project.org/src/contrib/ggplot2_4.0.3.tar.gz
Archive
https://CRAN.R-project.org/src/contrib/Archive/ggplot2
In views
ChemPhysNetworkAnalysisPhylogeneticsSpatialTeachingStatistics
Page fields
Author
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]
BugReports
https://github.com/tidyverse/ggplot2/issues
CRAN Checks
ggplot2 results
Citation
ggplot2 citation info
DOI
10.32614/CRAN.package.ggplot2
Enhances
sp
In Views
ChemPhys , NetworkAnalysis , Phylogenetics , Spatial , TeachingStatistics
License
MIT + file LICENSE
Maintainer
Thomas Lin Pedersen <thomas.pedersen at posit.co>
Materials
README , NEWS
NeedsCompilation
no
Old Sources
ggplot2 archive
Package Source
ggplot2_4.0.3.tar.gz
Published
2026-04-22
Reference Manual
ggplot2.html , ggplot2.pdf
Reverse Depends
accessrmd , afmToolkit , alakazam , alookr , AmpliconDuo , Anaconda , Anaquin , apisensr , applicable , ausplotsR , bacon , BasketballAnalyzeR , bayesDP , bayesnec , bbnet , bde , bhm , bmscstan , bootnet , bpcp , braidReports , bunching , CalibrationCurves , caret , CellNOptR , ceterisParibus , cfda , changepoint.geo , changeS , CHETAH , ChIPQC , circhelp , cjoint , ClassificationEnsembles , classifierplots , clustEff , ClusteredMutations , clustrd , CNVrd2 , CNVScope , coefplot , cogena , cohorttools , ConconiAnaerobicThresholdTest , ContourFunctions , corkscrew , CoSMoS , CRABS , CrispRVariants , crmPack , Crossover , CRTgeeDR , crumblr , CTxCC , curatedBreastData , cystiSim , cytofan , dae , DaMiRseq , dampack , dartR , dartR.base , dartR.sim , ddecompose , decompTumor2Sig , Deducer , deltaGseg , DendroSync , DepthProc , DEqMS , DHBins , diathor , diffEnrich , diffeR , DiSCos , dittoSeq , dittoViz , dnn , donutsk , dotwhisker , dowser , dpGMM , dreamlet , dslice , dynr , Eagle , echoice2 , eeptools , egg , embryogrowth , EnhancedVolcano , EnsCat , EpiCurve , episensr , EQUALCompareImages , EQUALPrognosis , EQUALrepeat , erccdashboard , escheR , eVCGsampler , extraChIPs , FactoClass , factoextra , factorplot , Factoshiny , fbroc , findGSEP , FisherEM , flippant , ForecastingEnsembles , forestmodel , FormulR , freqparcoord , frequency , func2vis , funMoDisco , gam.hp , gapmap , garma , GARS , gcerisk , gde , GenericML , genlogis , GenomicOZone , geomtextpath , geotoolsR , GerminaR , gg4way , ggalign , ggallin , ggalluvial , GGally , gganimate , ggarrow , ggbeeswarm , ggbio , ggbiplot , ggbuildr , ggcharts , ggcorrplot , ggcyto , ggdemetra , ggdensity , ggetho , ggExametrika , ggFishPlots , ggfixest , ggfocus , ggforce , ggformula , ggfortify , ggfoundry , gggda , gggenomes , ggghost , gggibbous , gggrid , ggh4x , gghighlight , ggHoriPlot , ggimage , ggincerta , gginnards , ggInterval , ggip , ggkegg , gglm , gglorenz , ggmanh , ggmap , ggmapcn , ggmatplot , ggmcmc , ggmulti , ggnetwork , ggOceanMaps , ggordiplots , ggpackets , ggparty , ggplot2.utils , ggpointless , ggpolar , ggpolypath , ggpp , ggpubr , ggragged , ggrain , ggraph , ggraptR , ggrepel , ggsced , ggside , ggspavis , ggspectra , ggsurvey , ggtern , ggthemeUL , ggvenn , ggvfields , ggwordcloud , GlarmaVarSel , glmm.hp , glow , GOfan , GOplot , gpmap , grafify , GRENITS , GSCA , GSD , gstar , Guitar , h5vc , HCmodelSets , HEDA , HelpersMG , HiLDA , hmmTMB , huito , hyperSpec , iarm , iBMQ , iCellR , ICSClust , ICSsmoothing , ICtest , idm , ifaTools , immunarch , InSilicoVA , interca , interplot , inti , intSDM , invacost , ioanalysis , IPDfromKM , IRTM , IsoformSwitchAnalyzeR , itemanalysis , itraxR , IVAS , kayadata , LabApplStat , LambertW , lavaSearch2 , lcc , legendry , likert , LinkHD , LipidMS , LipinskiFilters , lmap , localgauss , logihist , LogisticEnsembles , longRPart2 , loon.ggplot , LoTTA , malariaAtlas , maraca , maser , MCMC.qpcr , mcprofile , metacart , metaforest , metapone , methimpute , methodical , methylumi , mgcViz , miaViz , microbiome , MicroNiche , miLAG , MinEDfind , mirTarRnaSeq , missRows , MIXFIM , mixKernel , mixOmics , mixopt , MixOptim , MLSeq , monocle , MortalityTables , motifTestR , motoRneuron , mrfDepth , MultiGlarmaVarSel , multilevelPSA , MultisiteMediation , NanoMethViz , NanoStringNCTools , NanoTube , NBLDA , NBtsVarSel , Nebulosa , NetworkChange , ngsReports , NIRStat , nixmass , nonmem2R , normfluodbf , notame , notameViz , NTLKwIEx , NumericEnsembles , oceanwaves , octad , omada , OptimalRerandExpDesigns , optimos.prime , optrefine , ordr , OrgHeatmap , orgR , overlapping , PairedData , pAnalysis , PASWR2 , PCAtools , pep725 , perry , personalized , perspectev , phase1PRMD , phase1RMD , phenModel , phenoTest , photosynthesis , phylolm.hp , phyloseqGraphTest , PlasmaMutationDetector , plotcli , plotly , plotROC , pointRes , powerNLSEM , PPInfer , PPtreeViz , predint , primer , PRISMA , ProbBayes , profileR , promotionImpact , PSAboot , psc , pubh , PupillometryR , pvcurveanalysis , pvldcurve , qqplotr , qreport , quadrupen , QualityMeasure , quickpsy , r2spss , radiant.data , randomizeR , RATest , RatingScaleReduction , RcmdrPlugin.KMggplot2 , RCPA , rdacca.hp , recoup , remaCor , Repliscope , RFLOMICS , RGraphSpace , rifreg , rioplot , rise , RItools , RMOPI , RNAseqNet , RnaSeqSampleSize , RnBeads , Rnits , robcat , robCompositions , robmed , robustHD , Rqc , RSA , RSAtools , rSEA , RsSimulx , rtip , RVCompare , rwty , scater , scatterpie , scDDboost , SCdeconR , schex , scoper , SCOUTer , scRepertoire , SDLfilter , season , SeaVal , SEERaBomb , sensiPhy , seqsetvis , SetMethods , sgdGMF , shazam , shinyMixR , shinymodels , simaerep , simfit , simmer.plot , simmr , SimpleUpset , sitree , SKFCPD , SmarterPoland , SparseBiplots , spatialreg.hp , spqn , ssaBSS , sSNAPPY , ssviz , staRdom , StatMatch , strandCheckR , success , sugrrants , survHE , survminer , swa , SWMPr , tadar , tanggle , tbrf , TcGSA , tdr , TeachHist , teal.modules.general , tempted , TENET.ExperimentHub , TestAnaAPP , TestGardener , texmex , textanalyzer , tigger , TissueEnrich , TLCAR , TPD , TreeDep , TriMatch , TripleR , TrumpetPlots , tspmeta , useful , variancePartition , VectorCodeR , VEwaning , VEwaningVariant , visae , VplotR , WebAnalytics , weightr , WRTDStidal , xkcd , Xplortext , xpose , YAPSA
Reverse Enhances
cmocean , jamba , LOLA , parttree , surveillance , tind , tis
Reverse Imports
a11yShiny , ABACUS , abe , ABHgenotypeR , abseqR , AbSolution , absorber , abstractr , AcademicThemes , acc , acca , AccelStab , AcceptReject , accrualPlot , accSDA , ACDm , ACE , achieveGap , actel , activAnalyzer , ActivePathways , activPAL , actogrammr , actuaRE , actuary , actxps , ADAMgui , adaplots , ADAPT , adaptiveGPCA , adas.utils , add2ggplot , adegenet , adestr , AdIsMF , adjclust , adjROC , adnuts , adobeanalyticsr , adplots , adproclus , adrftools , AdsorpR , adsoRptionCMF , adventr , AdverseEvents , aeddo , aedseo , aelab , Aerith , AeRobiology , AeroSampleR , afcharts , AFFECT , affinitymatrix , affycoretools , AFR , afttest , agcounts , AgeBandDecomposition , AgePopDenom , AgeTopicModels , agfh , aggreCAT , agregR , agricolaeplotr , AgriDiversiX , agriReg , agriTutorial , agriutilities , agrobox , AgroR , AgroReg , agrostab , AgroTech , agua , ahnr , AHPGaussian , AHPWR , AIBias , AID , AIDA , aihuman , aimPlot , AIPW , airpart , airship , airt , akc , albersdown , aLBI , ale , alevinQC , alien , allestimates , allMT , AlphaBeta , alphahull , AlphaMissenseR , AlphaPart , AlpsNMR , AMARETTO , aMNLFA , amp , AMPLE , amplican , anabel , Analitica , analyzer , AnanseSeurat , anansi , Anaquin , aNCA , AnglerCreelSurveySimulation , animalcules , AnimalSequences , animbook , anipaths , aniSNA , ANN2 , AnnoProbe , annotatr , ANOFA , anomalize , anomaly , ANOPA , ANOVAIREVA , AntClassify , antedep , AntsNet , AnVILBilling , aoristic , APackOfTheClones , APAlyzer , APCI , APCtools , apexcharter , APIS , APL , aplot , aplotExtra , apm , APRScenario , APTIcalc , apyramid , AQEval , AquaticLifeHistory , aramappings , ARCensReg , archeofrag.gui , archeoViz , archipelago , archiveRetriever , ARCokrig , arcpullr , ARDL , ardlverse , arete , arima2 , artma , artMS , aRtsy , arulesViz , ArvindSt , ASICS , aslib , asmbPLS , ASML , aspline , asremlPlus , ASRgenomics , assertHE , ASSIGN , assignPOP , asuri , atacInferCnv , ATACseqTFEA , ATE.ERROR , Athlytics , ATQ , atRisk , atSNP , attrib , audiometry , AudioScatter , auditor , AutoAds , autocogs , autoFlagR , autoGO , autograph , autohrf , autoimage , automap , autoMR , autonomics , autoReg , AutoScore , autoScorecard , autoslider.core , autostats , autostsm , autotesteR , autotestR , autoTS , autovi , AVGAS , AvInertia , avstrat , aweSOM , aws.wrfsmn , azuremlsdk , BaalChIP , baclava , bacontrees , badp , baggr , BagWhiskerPlot , baker , bakR , baldur , bamdit , BANDITS , bandle , banter , BAQM , barbieQ , barrel , bartcs , bartMachine , bartMan , bartXViz , baseballr , basecallQC , baseq , BASiCS , basket , baskexact , BatChef , batchmix , BatchQC , BatchSVG , batchtma , bate , BAwiR , baycn , bayefdr , bayes4psy , bayesammi , BayesChange , BayesCTDesign , BayesCVI , bayesdfa , bayesDiagnostics , bayesEO , BayesERtools , BayesFBHborrow , BayesFM , bayesforecast , BayesGrowth , BayesianDEB , BayesianFitForecast , BayesianMCPMod , BayesianPlatformDesignTimeTrend , BayesianQDM , BayesianReasoning , bayesiansurpriser , bayesics , bayeslist , BayesMallows , BayesMallowsSMC2 , bayesmlogit , BayesMortalityPlus , bayesmove , bayesMRM , bayesmsm , BayesMultiMode , bayesplot , bayespm , BayesPostEst , BayesPower , bayesQRsurvey , bayesROE , BayesRS , bayesrules , BayesSenMC , BayesSIM , BayesSpace , BayesSurvival , BayesSurvive , BayesTools , bayesvl , BayesVolcano , bayesWatch , bayesZIB , bayMDS , baystability , bbdetection , BBEST , BCClong , BCEA , BCFM , Bchron , bdc , BDEsize , BDgraph , bdl , bdlim , bdots , bdrc , bdscale , bdsm , bea.R , beadarray , beadplexr , beastt , beaver , BeeBDC , BeeGUTS , beezdemand , beezdiscounting , behaviorchange , BEKKs , BElikelihood , benchdamic , bennu , Bernadette , besthr , bestSDP , betaARMA , betaclust , betaHMM , BetaPASS , betaregscale , bettr , BeyondBenford , bfbin2arm , BFF , bfw , BgeeCall , BGGM , BGPhazard , bibliometrix , biblioverlap , BIDistances , BIGL , bigsnpr , bigstatsr , bigtime , bikm1 , billboarder , BinarybalancedCut , BindingSiteFinder , binsreg , bioclim , BiocPkgDash , BiodiversityR , biodosetools , BioGA , biogrowth , BioGSP , bioinactivation , BioM2 , BIOMASS , biometryassist , biomod2 , BioNAR , BioNERO , BioPET , BioPETsurv , BioPred , bioRad , bioregion , biosampleR , bioSNR , BioStatR , biostats , biostats101 , BiostatsUHNplus , BioThermR , BioTIMEr , biotmle , BioUtils , BioVizSeq , birdcolors , birddog , birdscanR , biscale , bispdep , BiVariAn , BKTR , blandr , blase , Blend , blendR , blindspiker , bliss , blockCV , blockr.ggplot , blocs , BloodCancerMultiOmics2017 , BloodGen3Module , blorr , BLRShiny , BLRShiny2 , BlueCarbon , BMEmapping , bmgarch , bmggum , bml , bmlm , bmstdr , bnma , bnmonitor , BNPmix , BNSP , BOBaFIT , boinet , boiwsa , bolasso , BOLDconnectR , BoneDensityMapping , bonsaiforest , bootcluster , bootf2 , bootwar , BOP2FE , borealis , BoundaryStats , boxfilter , boxly , boxTest , bp , branchpointer , brandr , BrazilCrime , BRcal , BRCore , BREADR , breakaway , breakDown , breakfast , breakpointR , BreastSubtypeR , breathtestcore , bregr , brfinance , bridger2 , brinton , brisk , brms , brms.mmrm , broadSeq , brolgar , broman , BRRAT , bruceR , brulee , bsam , bsamGP , BSET , bSi , BSL , bsocialv2 , BSPBSS , bspcov , BSTFA , BSTZINB , bsynth , BTdecayLasso , BTSPAS , BTWAR , BulkSignalR , bullseye , bumbl , bupaR , burnr , BUSpaRse , butterflyOptions , BuyseTest , BVARverse , bvhar , C443 , CA3variants , cABCanalysis , cacc , CaDrA , CAESAR.Suite , CAFE , caffsim , cageminer , CAGEr , CAinterprTools , CAISEr , CALANGO , calendR , calendRio , CALF , calibmsm , CalibraCurve , calibrationband , CalibratR , callback , calmr , camcorder , CamelUp , campfin , campsis , campsismod , camtrapR , CaMutQC , canadianmaps , candisc , capl , caplot , capybara , carat , CARBayesST , carbonpredict , carbonr , card , cardelino , CardiacDP , CardioCurveR , CARDspa , care4cmodel , caresid , caretEnsemble , caretSDM , CarletonStats , carnation , carsAlgo , cartograflow , cartographr , casebase , CaseBasedReasoning , cases , cassandRa , cassowaryr , CAST , CATAcode , CATALYST , CatPredi , cats , CatsCradle , catviz , causact , causaldef , causalDT , CausalGPS , CausalImpact , CausalMixGPD , causalnet , causalOT , causalPAF , causalplot , causalQual , CausalQueries , CausalSpline , CausCor , CAvariants , CB2 , CBASSED50 , cbcTools , CBN2Path , CBNplot , cccrm , CCI , CCMnet , ccostr , CCPlotR , cdcatR , CDI , cdmTools , cdom , CDSim , ceas , CEDA , CEDMr , celaref , celda , CellBarcode , cellGeometry , CelliD , cellity , CellMentor , cellmig , CellMixS , CellTrails , cellWise , CEMiTool , CensMFM , CensRegSMSN , censuspyrID , Cepo , ceRNAnetsim , Certara.DarwinReporter , Certara.ModelResults , Certara.R , Certara.RsNLME.ModelBuilder , Certara.RsNLME.ModelExecutor , Certara.VPCResults , Certara.Xpose.NLME , CeTF , cfdnakit , cfDNAPro , CFO , cgam , cgmanalysis , cgmquantify , CGNM , ChainLadder , chameleon , ChAMP , changepoint.influence , ChannelAttributionApp , ChaosGame , chartql , ChauBoxplot , cheem , chem16S , ChemmineR , chemodiv , ChemoSpec , ChemoSpec2D , ChemoSpecUtils , chess2plyrs , chessboard , chest , ChestVolume , chevreulPlot , chevreulShiny , chevron , childsds , chillR , ChIPexoQual , ChIPpeakAnno , ChIPseeker , choicedata , CHOIRBM , chooseGCM , chopper , choroplethr , choroplethrAdmin1 , ChromSCape , chromVAR , chronicle , chronicler , chronochrt , CIARA , cicero , CICI , cifmodeling , CIMICE , CimpleG , CIMTx , cinaR , CINNA , CIpostSelect , circacompare , circRNAprofiler , CircSeqAlignTk , circumplex , CIS.DGLM , cisp , CiteFuse , cities , citrus , citsr , ciu , cjbart , CJIVE , clarify , ClassifyITS , ClassifyR , classmap , clc , Cleanet , CleaningValidation , cleanTS , CleanUpRNAseq , clevRvis , clhs , clickableImageMap , clickstream , climaemet , ClimaRep , climatehealth , ClimClass , climwin , clinDataReview , clinDR , clinicalfair , clinicalsignificance , ClinicalUtilityRecal , clinpubr , clintools , cliProfiler , clmplus , clockplot , ClonalSim , CLONETv2 , CLRtools , CluMP , CluMSID , clusEvol , ClusROC , ClussCluster , ClustAll , ClustAssess , ClusTCR2 , clustcurv , ClusterFoldSimilarity , ClusterGVis , Clustering , clusterMI , clusterProfiler , ClusterR , clusterWebApp , clustifyr , ClustImpute , ClustIRR , clustMD , ClusTorus , clustree , clustringr , CLVTools , cmaesr , cmahalanobis , cmAnalysis , CMapViz , cmgnd , CMMs , cmpp , cmprskcoxmsm , cmpsR , cmstatr , CMTFtoolbox , CNAIM , cnaOpt , CNEr , cNORM , CNSigs , CNVPanelizer , coalitions , CoastlineFD , cobalt , cocktailApp , COCOA , coconots , coda.plot , coda4microbiome , CoDaLoMic , codaredistlm , codebook , codez , codyna , coFAST , CoGAPS , cogeqc , Cogito , cogmapr , cograph , cohortBuilder , CohortMethod , CohortPlat , coinmarketcapr , Coinprofile , COINr , colleyRstats , coloc , colocalization , colorBlindness , colorist , colormap , colorrepel , colouR , colourpicker , comapr , ComBatFamQC , combi , combiroc , CoMiRe , COMIX , commecometrics , CommKern , comorbidPGS , CompAREdesign , compareMCMCs , compcodeR , CompensAID , competitiontoolbox , compIndexBuilder , ComplexUpset , complmrob , CompositeReliability , compositeReliabilityInNestedDesigns , ComPrAn , compSPOT , condorOptions , condvis2 , CONFESS , confidence , confidenceCurves , ConfidenceEllipse , ConFluxPro , ConfMatrix , confMeta , conformalInference.fd , conformalInference.multi , confoundvis , CoNI , Conigrave , conjoint , conos , conquestr , ConSciR , conserveR , consICA , ConsReg , contdid , conText , contourforest , contribution , contsurvplot , convdistr , convergEU , conversim , CooccurrenceAffinity , CoordinateCleaner , cophescan , Coralysis , coRdon , CoreMicrobiomeR , corncob , corona , CORPlot , corporaexplorer , corral , correlatio , correlationfunnel , Correlplot , corrr , corrViz , corTest , corx , coseq , CoSIA , cosimmr , cosinor , cosinor2 , COTAN , Counternull , countfitteR , countland , countries , countsimQC , countts , covalchemy , coveffectsplot , covidcast , CovidMutations , cowbell , cowplot , Coxmos , cpam , cplm , cpop , cpr , cprobit , CPSM , cpvSNP , crane , cranly , crayons , CrcBiomeScreen , crctStepdown , CRE , cricketr , crimeutils , CRISPRball , criticality , critpath , crm12Comb , CRMetrics , crmReg , cropDemand , crops , cropZoning , CrossCarry , CrossExpression , crosshap , crosslag , crossnma , crqa , crstools , CRTspat , crupR , cry , csa , csalert , csdb , CSeQTL , CSHShydRology , csmaps , csmpv , CSOA , cspp , csranks , CSSQ , cstidy , CSTools , csurvey , csutil , CTDquerier , CTexploreR , ctlr , ctmva , cTRAP , ctsem , ctsfeatures , ctsGE , ctsmTMB , cubar , cubble , cuperdec , cureplots , curtailment , curves , cusumcharter , cutpointr , cvasi , cvCovEst , CVglasso , cvms , cyanoFilter , cylcop , CyTOFpower , cytofQC , CytoGLMM , cytomapper , CytoMDS , cytometree , CytoPipeline , CytoPipelineGUI , CytoProfile , CytOpT , CytoSimplex , dabestr , dad , dada2 , dados , DAGassist , daiquiri , DAISIEprep , DALEX , DALEXtra , daltoolbox , DamageDetective , DAMEfinder , damidBind , Damsel , dann , dar , darksky , dartR.captive , dartR.popgen , dartR.sexlinked , dartR.spatial , data.table.threads , DatabionicSwarm , datacult , DataExplorer , DataFusionGDM , dataMaid , datamedios , datana , dataprep , dataquieR , dataReporter , dataspice , DATAstudio , DataVisualizations , datos , dbGaPCheckup , DBHC , dbmss , dbnlearn , dbplot , dbrobust , DBTC , dceasimR , DCEtool , dcortools , dCUR , dcurves , dcvar , DDESONN , ddpcr , ddPCRclust , ddtlcm , deaR , dearseq , debiasedTrialEmulation , DeBoinR , debrowser , DeCAFS , decemedip , decisionSupport , decompositionLE , decontam , decontX , DeconvoBuddies , decp , DedooseR , DeductiveR , DeepLearningCausal , deepMOU , deepSTRAPP , DeepTarget , deeptime , DEET , deFit , DegNorm , degradr , DegreeDayCalc , DEGreport , deliberr , DELocal , deltaCaptureC , deltaccd , dematel , DeMixT , demodelr , demor , demulticoder , demuxmix , dendextend , dendRoAnalyst , dendroTools , densityClust , densityratio , DepecheR , DEplotting , depower , derfinderPlot , DESA , DeSciDe , describedata , DescribeDisplay , descriptio , descriptr , descsuppRplots , deseats , DESeq2 , designit , DESNP , DESpace , desplot , destiny , DEsubs , detectnorm , detectRUNS , detectXOR , detzrcr , dexisensitivity , dextergui , DFD , DFIT , dfoliatR , Dforest , dfrr , dgpsi , DHSr , diagFDR , diagis , DiallelAnalysisR , diceplot , diceR , did , did2s , didec , DIDHAD , DIDmultiplegtDYN , diegr , DiffBind , DifferentialRegulation , diffUTR , difNLR , difR , digiRhythm , DIGSS , dilp , DImodels , DImodelsVis , dinoR , DiPALM , dipm , Directional , dirichletprocess , disaggregation , DisasterAlert , disbayes , DIscBIO , discharge , DiscoRhythm , discourseGT , discoveR , discovr , DiscreteDLM , DiscreteGapStatistic , dispersionIndicators , disprofas , distinct , DistPlotter , DistributionOptimization , distributions3 , ditwahLandslide , divent , diversityForest , DIVINE , diyar , dlim , DLMtool , dlmtree , dlookr , dlstats , dmai , dmbc , dMod , dMrs , dmrseq , dndR , dobin , doBy , dogesr , dominanceanalysis , dominatR , doolkit , door , Doscheda , DOSE , dosedesignR , DoseFinding , DOtools , dots , dotsViolin , doubletrouble , douconca , downloadthis , DOYPAColors , dpasurv , DPCD , dPCP , DPI , DPpack , DQA , dqcheckr , DR.SC , dr4pl , drawProteins , dreamer , drhutools , drimmR , DRIMSeq , drMAIC , DRomics , dropR , drord , drpop , DRsurvCRT , drugsens , ds4psy , dsa , DSAIDE , DSAIRM , dsBaseClient , dscoreMSM , dsem , dsims , DSIR , dslabs , dsm , dsos , DspikeIn , dssd , dst , DstarM , dStruct , dtComb , DTRreg , dtwclust , dualScale , duet , dumbbell , Dune , DuoClustering2018 , DUToolkit , DVHmetrics , dvmisc , dycdtools , dymo , dynamite , dynaSpec , DynForest , dyngen , DynNom , dynRB , dynsim , dynsurv , DySS , E2E , e2tree , eam , earlyR , earthUI , easier , easyalluvial , easybgm , easybio , EasyCellType , easylabel , easynem , easyRaschBayes , EasyStat , easysurv , eat , EBASE , ebm , ebnm , ecan , ECDFniche , ecic , eclipseplot , ecocbo , ecochange , EcoCleanR , ecocomDP , ecode , EcoDiet , EcoEnsemble , ecolottery , EcoMetrics , EcoNetGen , EcoNiche , ecostate , ecoTolerance , EcotoneFinder , ecoXCorr , ecr , eda4treeR , edar , EDCimport , edeaR , edecob , edina , eDNAfuns , eDNAjoint , EDOIF , edstan , EEAaq , eefAnalytics , EEM , EFA.MRFA , EFAtools , EffectLiteR , effectplots , ega , EGAnet , EGM , EGSEA , eHDPrep , eiExpand , eirm , EIX , eks , EL , EleChemr , elfgen , Elja , ELMER , ELViS , EMAS , emBALVI , EmbedSOM , emcAdr , emdi , EMDomics , emery , EMGCR , EmiR , EMMIXgene , emojifont , EMOTIONS , EmpiricalCalibration , EmpiricalDynamics , emreliability , emstreeR , EMTscoreData , endtoend , enetLTS , EnMCB , ENMeval , enmSdmX , ENMTools , enpls , EnrichDO , EnrichIntersect , enrichplot , enrichR , ensembleTax , ensModelVis , ensr , entropart , EntropicStatistics , envalysis , EnvStats , eoffice , epe4md , epicmodel , epiCo , EpiCompare , epicR , epidecodeR , EpiDynamics , EpiEstim , epifitter , epiflows , EpiForsk , epigraHMM , epikit , EpiLPS , epimdr2 , EpiMix , EpiModel , epimutacions , epinetr , EpiNova , EpiNow2 , epiomics , epiphy , EpipwR , epiregulon.extra , EpiReport , epiSeeker , episomer , epistasisGA , EpiTest , epiviz , epiworldRShiny , EPLSIM , epmfd , Epoch , epos , epts , eq5dsuite , EQUALSTATS , ER , ern , ernm , ErrorTracer , ERSA , ERSSA , eRTG3D , ervissexplore , esATAC , escalation , escape , esci , esemifar , eSIR , esmisc , esmtools , esquisse , estadistica , estar , EstHTSeed , EstimateBreed , EstimateGroupNetwork , estimators , EstimDiagnostics , esvis , esviz , ethnobotanyR , etrm , eudract , eufmdis.adapt , evalHTE , evalITR , EvalTest , EvaluateCore , EValue , evaluomeR , EVchargcost , eventPred , eventreport , eventstudyr , EVI , EvidenceSynthesis , evolqg , EvolutionaryGames , Evomorph , evoper , EvoPhylo , evprof , evsim , EWCE , ewoc , EWSmethods , exactamente , examly , exceldata , excessmort , ExPanDaR , ExpBites , expertsurv , ExpGenetic , expirest , explainer , ExplodeLayout , explor , exploratory , explore , ExploreModelMatrix , exploreR , ExpoRiskR , expowo , ExpressionCellNet , exreport , extraSuperpower , ExtremeCI , extrememix , exuber , eyelinkReader , eyetools , eyetrackingR , ez , EZbakR , ezcox , ezCutoffs , EZFragility , ezplot , ezr , ezTrack , f1pits , fabletools , fabMix , FactoInvestigate , FactoMineR , FactorHet , factR , FAfA , fahb , fairadapt , fairGATE , fairGNN , fairmodels , fairness , familial , Families , FARS , fasstr , FAST.R , fastai , fastdid , fastFGEE , fastFMM , FastKRR , fastml , fastqcr , fastR2 , fastrep , FastRet , fastRG , fastText , fastTopics , FastUtils , faux , FAVA , FAVAR , fCCAC , fcfdr , fChange , fcm , FCO , FCPS , fdacluster , fdANOVA , fdapaceShiny , fdaPOIFD , fdp , fdq , fdrci , feasts , FeatureImpCluster , FeatureTerminatoR , fect , FedData , FedIRT , fedup , fEGarch , fence , fenr , FEprovideR , ferrn , ffaframework , ffp , fftab , fgdiR , fgeo.plot , Fgmutils , fgsea , fic , fido , FielDHub , FieldSimR , figpatch , fillpattern , finalfit , FinanceGraphs , FinCal , FIND , FindIT2 , findn , findviews , finetune , fingerPro , finlabR , finna , finnsurveytext , fireexposuR , FishDiveR , fishRman , fishualize , fitbitViz , fitlandr , fitODBODRshiny , FitUltD , fitur , fixes , fkbma , FKmL , FLAMES , flametree , flashier , flashlight , flex , flexFitR , flexIC , flexoki , FlexReg , flexsurv , flexurba , FlexVarJM , FLightR , flimo , flipr , FLORAL , flowAI , flowCHIC , flowGate , flowGraph , flowmapper , FlowSOM , flowSpecs , flowTraceR , flowWorkspace , flps , fluxible , FluxPoint , FluxSeparator , fmeffects , fmi , FMradio , fmriqa , fobitools , folda , fonctionr , footBayes , foqat , forcis , FoRDM , forecast , forecastHybrid , ForeComp , forensicolors , foreSIGHT , forestat , forestecology , ForestElementsR , forestinventory , forestly , forestmangr , forestr , forestsearch , ForIT , formods , fourSynergy , FPDclustering , fpp2 , fpp3 , fqar , fqardl , FracFixR , fractalforest , fRagmentomics , frailtyEM , frailtySurv , FRASER , FreqProf , frequentdirections , FRI , FRK , fsdaR , fsemipar , fsr , fSRM , fst4pg , ftaproxim , funcharts , funcml , funkycells , funkyheatmap , funModeling , FunnelPlotR , funnelR , funStatTest , FunSurv , FuseSOM , fusionchartsR , fuzzyforest , FuzzyPovertyR , FuzzySpec , fxTWAPLS , G2Sd , G4SNVHunter , gaawr2 , GABB , GACE , GALLO , gamma , gammaFuncModel , gamutil , gap , gapclosing , gasmodel , gasper , gastempt , gatom , GauPro , gaussplotR , gbm.auto , GBScleanR , GCalignR , GCEstim , gclink , gCrisprTools , GCubeR , gcxgclab , GDAtools , GDCRNATools , gdim , GDINA , gdverse , gecko , GeDi , gedi2 , geeasy , GEInter , GEM , gemini , gemR , gen5helper , genBaRcode , GenderInfer , genekitr , geneNR , GeneralizedUmatrix , GeneralizedUmatrixGPU , genetic.algo.optimizeR , geneticae , GeneTonic , GenHMM1d , genMCMCDiag , genomation , GenomeAdmixR , GenomicDistributions , GenomicInteractions , GenomicPlot , GenomicSuperSignature , GenoTriplo , genSEIR , GenVisR , GeoAdjust , geocausal , geocmeans , geofacet , geohabnet , geoheatmap , geomander , geomerge , geomorph , GeomxTools , geonuts , geosimilarity , geospatialsuite , geostan , germinationmetrics , GET , getmstatistic , getspanel , geyser , gfer , gfoRmula , gfoRmulaICE , gg.gap , gg1d , ggaligner , ggalignment , ggarchery , ggauto , ggautomap , ggblanket , ggblend , ggborderline , ggbrace , ggbrain , ggbreak , ggbrick , ggBubbles , ggchangepoint , ggChernoff , ggchord , ggcleveland , ggcompare , ggcorrheatmap , ggdag , ggdaynight , ggdendro , ggdiagram , ggdibbler , ggdiceplot , ggdist , ggdmc , ggDNAvis , ggDoE , ggDoubleHeat , ggeasy , GGEBiplots , ggEDA , ggenealogy , GGenemy , ggerror , ggExtra , ggfacto , ggfields , ggfigdone , ggfittext , ggflowchart , ggfootball , ggforestplotR , ggfun , ggfx , gggap , gggenes , ggguides , gghalfnorm , gghdx , gghexsize , gghinton , gghist , gghourglass , ggimg , gginference , ggiraph , ggiraphExtra , ggisotonic , gglgbtq , gglinedensity , gglogger , gglycan , gglyph , ggmapinset , ggmice , GGMncv , ggmRSCU , ggmsa , ggmugs , ggmuller , ggnewscale , ggnormalviolin , ggokabeito , GGoutlieR , ggpage , ggpath , ggpattern , ggpca , ggpcp , ggpedigree , ggperiodic , ggpicrust2 , ggplate , ggplayfair , ggplot.multistats , ggplotAssist , ggplotgui , ggplotify , ggpmisc , ggPMX , ggpointdensity , ggpop , ggprism , ggpval , ggQQunif , ggquickeda , ggquiver , ggRandomForests , ggrastr , ggrcs , ggrecipes , ggredist , ggrefine , ggreveal , ggridges , ggrisk , ggrounded , ggRtsy , ggsankeyfier , ggsc , ggScatRidges , ggsci , ggscidca , ggscribe , ggseg , ggseg.formats , ggsegmentedtotalbar , ggsem , ggseqalign , ggseqlogo , ggseqplot , ggshadow , ggsignif , ggskewboxplots , ggsky , ggsmc , ggsoccer , ggsolvencyii , ggsom , ggspark , ggspatial , ggstackplot , ggstance , ggstar , ggstats , ggstatsplot , ggstudent , ggsurveillance , ggsurvfit , ggswissmaps , ggtangle , ggtea , ggtext , ggThemeAssist , ggthemes , ggtibble , ggtikz , ggtime , ggtrace , ggtranslate , ggtree , ggtreebar , ggtreeDendro , ggtreeExtra , ggtreeSpace , ggtrendline , ggtricks , ggupset , ggvariant , ggvegan , ggVennDiagram , ggview , ggvolc , ggvolcano , ggWebGL , ggwidth , ggx , GHRexplore , GHRmodel , GIC , gimap , GimmeMyPlot , giniCI , gINTomics , gipsDA , gJLS2 , GJRM , gkwreg , GladiaTOX , glioblastomaEHRsData , GLMMcosinor , glmmfields , glmmPen , glmmsel , glmmSeq , GlmSimulatoR , glmSparseNet , glmtlp , glmtrans , globaltrends , glober , GloScope , glossa , glsm , gluvarpro , glycoTraitR , gMCPLite , gmgm , gMOIP , GMSimpute , GNAR , GNET2 , gnonadd , GOaGO , goat , goatea , GOCompare , GOexpress , GofCens , gofreg , goldfish , gompertztrunc , Goodreader , gooseR , gosset , GOTHiC , GowerSom , GPA , GPflexViz , gprofiler2 , gpss , GPTCM , GPvam , grabsampling , GrafGen , grainscape , grandR , GRaNIE , granovaGG , graper , grapesAgri1 , graph4lg , grapherator , graphonmix , graphPAF , grasps , gratia , gravitas , greatR , greed , GreedyExperimentalDesign , greeks , GREENeR , greenfeedr , greenR , greport , Greymodels , GRIDCOPULA , gridsampler , GRIN2 , GRmetrics , grmtree , grobblR , grouprar , GrowthCurveME , growthPheno , growthTrendR , grpsel , GRShiny , grwat , GSABenchmark , gsaot , gsbDesign , gscaLCA , gscramble , gsDesign , gsDesignTune , GSE , GSEAmining , gseries , GSparO , gspcr , gsynth , GTAPViz , gtExtras , gtregression , gtrendsR , guideR , GUIDEseq , guiplot , gumboot , GUniFrac , gunsales , gwaRs , gwasforest , GWASinspector , GWENA , gwid , GWlasso , gWQS , HaDeX , HaDeX2 , hagis , hahmmr , haldensify , halfmoon , hammers , handwriter , handwriterApp , HanStat , Hapi , HaploCatcher , harbinger , harmony , harrypotter , hatchR , hbal , hbamr , hbsaems , hcruR , hdcuremodels , hdflex , hdm , hdme , hdnom , hdpGLM , hdrcde , HDStIM , hdxmsqc , healthfinance , healthyR , healthyR.ai , healthyR.ts , heartbeatr , heatmaply , heatwaveR , HeckmanEM , heemod , heimdall , heiscore , helixvis , henna , hermes , hesim , hespdiv , HetSeq , hettx , heumilkr , hexSticker , HGC , HHBayes , hhmR , HicAggR , HiCaptuRe , HiCBricks , HiCcompare , HiCDOC , HiContacts , hicVennDiagram , hidecan , hierarchicalSets , hierNest , highlightr , highMLR , himach , hipathia , hipecR , HIPPO , HistDAWass , HistoImagePlot , historicalborrow , historicalborrowlong , HIViz , hJAM , HLMdiag , hlmLab , hlrhotrix , hlt , HMDA , hmde , hmer , Hmisc , Hmsc , hmsidwR , hockeystick , HodgesTools , holi , holobiont , Holomics , HonestDiD , hoodscanR , hopbyhop , HoRM , HospitalNetwork , HotellingEllipse , HPAanalyze , HPiP , hpiR , hrbrthemes , hsstan , hstats , htmlreportR , htrSPRanalysis , htsr , HTT , httk , HuraultMisc , hurricaneexposure , HVT , HybridExpress , hybridModels , hydraulics , hydroroute , hydrotoolbox , hydroToolkit , hyfo , hypeR , hyperoverlap , hypervolume , HYPEtools , hyreg2 , HZIP , iai , IAPWS95 , iAR , ibawds , ibdfindr , ibdsim2 , IBLM , IBMPopSim , iBreakDown , icardaFIGSr , ICBioMark , iccCounts , ICEbox , ICEHmeasures , icertool , icetea , iclogcondist , iClusterVB , icmstate , iCNV , iCOBRA , icpack , IDE , IDEAFilter , ideal , idealstan , ideamdb , ideanet , IDEATools , idiffomix , idiolect , idionomics , IDMIR , idopNetwork , idpr , idr2d , IETD , ig.degree.betweenness , iglu , ihclust , iheiddown , IHWpaper , ILORA , ILoReg , ILRCM , imageData , imageRy , imageTCGA , imcRtools , ImFoR , IMIX , iml , ImML , immunaut , immundata , immunogenViewer , immunotation , Imneuron , ImNN , iModMix , IMP , impermanentlosscalc , important , imprinting , imputeTestbench , imputeTS , imsig , imt , ImVol , IncDTW , incidence , incidental , incR , inctools , inDAGO , IndGenErrors , industRial , INetTool , iNEXT , iNEXT.3D , iNEXT.4steps , iNEXT.beta3D , infer , infercnv , inferCSN , InflectSSP , Inflongitudinal , influenceAUC , influential , Information , ingredients , injurytools , INLAjoint , inlamemi , innsight , ino , inough , InPAS , insane , insetplot , insurancerating , int3ract , INTACT , InTAD , IntegratedJM , integrity , intensitynet , InteractionPoweR , interactions , InterCellar , interflex , interpretCI , intervalpsych , inTextSummaryTable , intradayModel , intRinsic , intsvy , inventorize , invitroTKstats , invivoPKfit , iNZightRegression , iNZightTS , IOBR , IONiseR , iotarelr , ip2location , ip2proxy , iPath , ipeaplot , ipfr , ipft , IPLGP , iprior , iPRISM , ipsRdbs , IPV , ir , iraceplot , IRexamples , iRfcb , IRon , IRTest , irtpwr , irtQ , irtsim , ISAnalytics , iSEE , iSEEfier , iSEEhex , iSEEpathways , iSEEtree , iSEEu , Isinglandr , islasso , isobar , IsoBayes , isobxr , isomiRs , isoorbi , isopam , ISRaD , istat , iSTATS , iSTAY , itan , ITNr , its.analysis , itsdm , ivd , ivDiag , ivmodel , ivolcano , ivygapSE , iwaqr , jackstrap , jadeLizardOptions , janus , janusplot , jarbes , jcext , jcolors , Jdmbs , jenga , jfa , jmastats , JMbayes2 , jmBIG , jmv , joineRML , joinpointR , jointVIP , joker , jollofR , JOPS , JPSurv , jrSiCKLSNMF , jrt , jskm , jsmodule , jtdm , jtools , junco , JustifyAlpha , JWileymisc , k5 , kaos , kardl , karyotapR , katdetectr , kendallRandomWalks , kernelPhil , kerntools , kesernetwork , keyATM , Keyboard , kfino , kfre , kgschart , kindisperse , kindling , kissDE , kitesquare , klovan , KMEANS.KNN , kmed , Kmedians , KMunicate , knfi , knobi , KnowSeq , knowYourCG , kollaR , konfound , kpcaIG , KraljicMatrix , kronos , kssa , kvr2 , L0cpt , L0Learn , L0TFinv , l1kdeconv , l1rotation , l1spectral , lablaster , labNorm , labsimplex , LACE , LACHESIS , lactater , lacunr , LAD , LadderFuelsR , lakefetch , lakhesis , lambdaTS , Landmarking , landscapemetrics , lans2r , lapop , lares , latbias , LatentBMA , latentcor , LATERmodel , latte , lavinteract , layer , lazytrade , LBBNN , LBSPR , lcars , lcmsPlot , LCMSQA , LCPA , lcsm , LDATree , lddmm , ldhmm , ldmppr , LeadSense , leaf , leakr , leapR , LEdecomp , LedPred , lefser , LegATo , lehuynh , lemna , lemon , lessSEM , levi , LexisPlotR , LFApp , lfmm , lfproQC , lg , lgpr , Lheuristic , lifeR , Lifertable , LifeTableBuilder , LightLogR , likelihoodTools , LikertEZ , lilikoi , LilRhino , lime , limpca , lindia , lineagefreq , lineartestr , linkspotter , Linnorm , lipidomeR , LipidomicsR , lipidr , LipidTrend , lisaClust , lisat , litRiddle , litteR , live , liver , llama , llrem , LLSR , LMD , lmeresampler , lmerTest , LMMstar , LMoFit , lncRna , localICE , localModel , locuszoomr , loewesadditivity , LOGAN , logisticPCA , lolog , lolR , lomb , LongDat , LongDecompHE , longitree , longitudinalcascade , longreadvqs , lookout , LorenzRegression , LorMe , lpcde , lpdensity , lpirfs , LPRelevance , LRcell , lrstat , LSAMBA , lsirm12pl , lsl , lslx , lsm , lspartition , LSTbook , LSTS , LSX , ltc , LTCDM , lterpalettefinder , ltertools , LTFHPlus , lvmisc , lvplot , LymphoSeq , m2b , M3C , Maaslin2 , maaslin3 , MACER , MachineShop , macrosyntR , MACSQuantifyR , madshapR , MAGMA.R , MagmaClustR , maicChecks , MAICtools , maidr , MAIHDA , MAINT.Data , makemyprior , mammalcol , MandalaR , manhplot , MannWhitneyCopula , MantaID , mantis , manureshed , manydata , ManyIVsNets , manymodelr , manymome , mapbayr , mapcan , MAPCtools , MAPFX , mapindia , mapmixture , MapperAlgo , mappestRisk , MappingCalc , mappoly , mapycusmaximus , marcox , marimekko , markeR , MarketMatching , Markovchart , markstat , marmap , marr , mascarade , MassWateR , MAST , mastR , matricks , MatrixQCvis , matuR , mau , MaxentVariableSelection , MaxIntTools , MaxWiK , MBAnalysis , MBECS , MBMethPred , MBNMAdose , MBNMAtime , MBQN , mbQTL , mbreaks , mbRes , MBRM , mbsts , mbX , mc2d , MCAvariants , mcb , MCbiclust , mccca , mcdabench , mcMST , mcmsupply , MCOE , Mcomp , mcp , mcradds , mCSEA , mcStats , mctq , MCTrend , mcvis , mda.biber , MDCcure , MDDC , MDgof , mdp , mdpeer , MDPIexploreR , mdsr , MDSvis , MEAanalysis , MEAL , measureR , meconetcomp , mecoturn , mectx , medfate , medfateland , meerva , mekko , MeLSI , meltt , mem , memapp , meme , memery , memes , memoria , MendelianRandomization , merTools , MesKit , MESS , messi , messina , meta , MetaboAnnotatoR , MetaboDynamics , metabolic , MetabolicSurv , metabom8 , metabomxtr , metabup , metacoder , metaconfoundr , MetaCyto , metadeconfoundR , MetaDICT , MetaDose , metaEnsembleR , MetaEntropy , metagam , metaGE , metagene2 , metagroup , metainc , MetAlyzer , metamisc , metamorphr , metan , MetaNet , metanetwork , MetaPhOR , metaplot , metapower , MetaProViz , metaquant , MetaRVM , MetaScope , metasnf , metavcov , metaviz , MetBrewer , MetCirc , MethodOpt , MethReg , methrix , MethScope , MethylAid , methylclock , methylGSA , methylInheritance , MethylMix , MetMashR , MetNet , metools , metR , metrica , MetricGraph , MetSizeR , MexBrewer , MF.beta4 , mFD , mFLICA , MFO , mfp2 , mfpp , mgee2 , mglasso , mgwrhw , mgwrsar , mhpfilter , MIC , miceRanger , microbial , microbiomeDASim , MicrobiomeProfiler , MicrobiomeStat , MicrobiomeSurv , MicrobiotaProcess , MicrobTiSDA , microdiluteR , microeco , micromap , microplot , MICSQTL , midi , MIGEE , miloR , MIMSunit , mina , mineCitrus , minimaxALT , mipplot , miQC , MIRA , mirIntegrator , MIRit , MiRNAQCD , misc , mispitools , missCompare , MissCP , missingHE , missMDA , misspi , missSBM , mistral , misty , mistyR , mitch , mitey , mitoClone2 , MitoHEAR , mitology , mixedbiastest , MixedIndTests , mixedLSR , MixedPsy , MixLFA , MixMashNet , mixpoissonreg , mixR , MixSIAR , mixtur , mixvlmc , mizer , MKdescr , MKinfer , MKmisc , MKpower , mlbplotR , MLCausal , MLDataR , MLEce , mlergm , MLeval , mlmc , mlmoderator , MLmorph , mlmtools , mlpwr , mlr , mlr3benchmark , mlr3fairness , mlr3spatiotempcv , mlr3viz , mlspatial , mlts , MLwrap , MLZ , mmaqshiny , MMDiff2 , mmeta , mmibain , MMRcaseselection , MMUPHin , mnda , mnem , mobileRNA , mod2rm , modACDC , ModalForecast , model4you , modeldb , modelDown , modelscompete4 , modeltime , modeltime.resample , moderate.mediation , moderndive , modgo , modnets , modsem , MOFA2 , MoleculeExperiment , MOMA , monaLisa , monochromeR , monoClust , monolix2rx , MonotonicityTest , moodleR , Moonlight2R , morepls , MorphoRegions , morse , morseDR , morseTKTD , mosaic , mosaicCalc , MOSClip , mosdef , MOSim , MotifPeeker , motifr , motifStack , MouseFM , mousetrap , movedesign , moveEZ , movegroup , moveHMM , movementsync , MPAC , mpactr , mpathr , mplot , MplusAutomation , MplusLGM , mpmsim , mpoly , mpower , mppR , mpwR , mrct , mrf2d , MRFcov , MRG , mrgsim.sa , mrIML , MRMCaov , mrPStrata , MRStdLCRT , MRTSampleSizeBinary , MRZero , MSclassifR , MSclust , MSCMT , msdrought , MSEtool , msgbsR , mSigPlot , MSigSeg , MSnbase , MSnID , mspms , MSPRT , msPurity , msqrob2 , MsQuality , MSstats , MSstatsLiP , MSstatsLOBD , MSstatsPTM , MSstatsQC , MSstatsResponse , MSstatsShiny , MSstatsTMT , mstATA , MSUthemes , mt.surv , mtb , mtdesign , MTest , mtrank , MUACz , mudfold , mulea , mulgar , MultANOVA , MultiATSM , MultiBaC , multibias , multibreakeR , multiCCA , MultiClassROC , multicrispr , multid , MultiDataSet , multiDimBio , multiDoE , multifear , MultiGroupO , multilandr , multilevelcoda , multilevelTools , multimedia , multinma , multinomialLogitMix , MultiObjMatch , multipanelfigure , multipleITScontrol , multipleOutcomes , multiplestressR , MultiResponseR , multiRL , MultiRNAflow , multiScaleR , multiscape , MultiSpline , multistateQTL , MultiTraits , multivar , MultivariateAnalysis , multivarious , multiWGCNA , MultRegCMP , munch , MuPETFlow , muscat , musclesyneRgies , musicatk , MutationalPatterns , mutscan , MutSeqR , mutSignatures , mvdalab , mverse , MVET , mvfmr , mvgam , MVN , mvnimpute , mvnma , mvSUSY , MWASTools , mwmap , mxfda , mxnorm , mycaas , myClim , mycolorsTB , myTAI , NACHO , naive , nandb , naniar , NatParksPalettes , natstrat , NCA , ncappc , NCC , ncmR , ncRNAtools , nearBynding , neatmaps , necountries , NeEDS4BigData , negligible , nemtr , neodistr , neonPlantEcology , neonSoilFlux , neptune , NeStage , nestcolor , nestedcv , nestedpp , Nestimate , netcom , netdose , nethet , netmeta , netprioR , netresponse , netropy , NetworkExtinction , NetworkInference , NetworkRiskMeasures , networkscaleup , networktools , neuralGAM , NeuralNetTools , NeuralSens , NeuroDecodeR , neuroim2 , neuroimaGene , neuromapr , neuromplex , neuroUp , neutralitytestr , neutrostat , nevada , nflplotR , ngme2 , ngramr , nhdR , NHSRplotthedots , nhstplot , NiLeDAM , nima , NIMAA , nimblewomble , nipalsMCIA , nixtlar , nlgm , nlive , nlmeVPC , nlmixr2extra , nlmixr2plot , nlmixr2rpt , nlpsem , NMA , NMADTA , NMAforest , NMAoutlier , nmaplateplot , nmathresh , NMF , nmrrr , NMTox , nncc , nnTensor , nntmvn , noisemodel , noisyr , noisySBM , nomiShape , NonlinearDiD , nonmem2rx , nonParQuantileCausality , NoRCE , nord , NormalityAssessment , NormalyzerDE , normref , nortsTest , NOVA , novelqualcodes , nowcastr , nparACT , NPBayesImputeCat , npboottprm , npclust , npcs , npde , NPflow , nph , nphRCT , npregfast , nprobust , NPStability , NSMM , nucleR , nudibranch , NUETON , nuggets , nullabor , nullranges , numbat , NutrienTrackeR , nzilbb.vowels , o2geosocial , o2plsda , oaPlots , OAtools , oaxaca , obAnalytics , OBL , obliqueRSF , oceanexplorer , oceanic , oceanmap , oCELLoc , ocf , OddsPlotty , oddsratio , oddstream , ODMeans , OEFPIL , oeli , OenoKPM , ofpetrial , ogrdbstats , OGRE , OhdsiReportGenerator , oHMMed , ohun , okcolors , OlinkAnalyze , olsrr , OLStrajr , OlympicRshiny , OmicFlow , OmicNetR , omicRexposome , OmicSense , omicsGMF , OMICsPCA , OmicsPLS , OmicsPrepR , omicsTools , omicsViewer , Omixer , omu , ONAM , onbrand , OncoBayes2 , oncomix , OncoSimulR , onemap , OneSampleLogRankTest , onewaytests , OnlineSurr , onpoint , onsvplot , ontophylo , oolong , openair , openairmaps , openEBGM , openintro , openMSE , OpeNoise , openPrimeR , openSkies , OpenStreetMap , openVA , opGMMassessment , opImputation , OPL , oppr , optconerrf , optedr , opticskxi , optsize , optweight , oRaklE , Orangutan , orbitr , ordbetareg , ordinalsimr , ordPanel , oreo , orf , ORFID , ORFik , orisma , ormPlot , orthogene , orthos , OSLdecomposition , Ostats , OTclust , otsfeatures , outbreaker2 , OutcomeWeights , outlierMBC , OutliersO3 , outlierspinner , OUTRIDER , outstandR , overshiny , overviewR , OVtool , OxSR , pa , PAC , pacheck , packageRank , pacotest , pacta.multi.loanbook , PAFit , PAGFL , painbow , pairedGSEA , palaeoSig , palettephines , palettes , pam , PamBinaries , PAMmisc , pammtools , PAMpal , PAMscapes , pandaR , pandemonium , panelhetero , PanelMatch , panelr , panelvar , panelView , pannotator , parafac4microbiome , paramhetero , parasiteR , ParCC , Paris2024Colours , parmsurvfit , parsnip , partition , partR2 , PAST , pastaPlot , patchwork , pathfindR , pathlinkR , pathMED , PathoStat , paths , pathviewr , PathwaySpace , patientProfilesVis , patterncausality , patternplot , PAutilities , pbcc , pc , pcadapt , PCADSC , pcaExplorer , PCBS , PCMBase , pctax , pcutils , pcvr , PDATK , PDEnaiveBayes , PDN , pdp , PDXpower , PeacoQC , peakPantheR , pedbp , Pedixplorer , pedtricks , PEIMAN2 , pema , pems.utils , penAFT , penaltyLearning , pepdiff , pepe , PepMapViz , peppwR , PepsNMR , pepStat , pequod , periodicDNA , periscope , PERK , permubiome , personr , PERSUADE , perturbR , petersenlab , PFIM , PGaovR , PGRdup , pGRN , pguIMP , pgxRpi , phacking , phantasus , PharmacoGx , PhaseType , phateR , phdcocktail , phenofit , phenopath , PheVis , philr , PhosR , phylepic , phylopath , PhyloProfile , phyloseq , phylter , phytoclass , PhytoIn , pid , PieGlyph , Pigengene , piglet , pimeta , pioneeR , pipeComp , Pirat , piratings , PIUMA , PKbioanalysis , pkggraph , pkpd.Release , pksensi , platetools , PlateVision , plattice , plausibounds , PlayerChart , PLEXI , plinkQC , PLMIX , PLNmodels , PLORN , plot3logit , plot4fun , plotdap , plotGMM , plotGrouper , plotlsirm , plotluck , plotMElm , plotmm , PlotNormTest , plotor , PlotPrjNetworks , plotrr , plotthis , PLSDAbatch , plsmmLasso , PLUCR , plutor , pmartR , pmc , pmev , pmp , pmrm , PMScanR , pmxNODE , pmxTools , POCRE , PoDBAY , PoDCall , pogit , pogos , PointedSDMs , PointFore , poisonfrogs , polarisR , PolicyPortfolios , polimetrics , politeness , polymatching , polypoly , Polytect , POMA , POMADE , pomcheckr , pompom , PopComm , PopED , PopGenHelpR , PopGenReport , poppr , PopPsiSeqR , popPyramid , popsom7 , popstudy , populationPDXdesign , portfolioBacktest , posDemux , postcard , postNet , poth , pould , powerbrmsINLA , powerbydesign , PoweREST , powerly , powerprior , powRICLPM , PowRPriori , POWSC , ppcseq , ppcSpatial , ppgmmga , PPQplan , pprof , ppseq , ppsr , PPtreeExt , PracticalEquiDesign , PracTools , prakriti , prcbench , prcr , PRECAST , pRecipe , precisely , precmed , precrec , predict3d , predictionInterval , predictMe , predictmeans , predictNMB , predieval , PredPsych , predRupdate , predtools , preference , prefviz , PReMiuM , prepkit , PreProcessing , PressPurt , pressuRe , PrettyCols , prettyPanelMatch , prevR , pRF , PriceIndices , pricesensitivitymeter , primerTree , priorityelasticnet , priorsense , prism , proActiv , ProActive , ProAE , probably , proBatch , ProbBreed , processmapR , processmonitR , processpredictR , prodlim , productplots , ProFAST , profoc , progeny , ProjectionBasedClustering , projections , projectLSA , projectR , projoint , projpred , pRoloc , pRolocGUI , promethee123 , PrometheeTools , promor , PRONE , prophet , Prostar , protag , protein8k , ProteinPCA , ProteoBayes , ProteoMM , proteus , protGear , protti , psbcSpeedUp , psborrow , pscore , psdr , pseudoCure , psfmi , psichomics , PSLM2015 , psm3mkv , psmineR , pspatreg , psre , psrwe , PSS.Health , PSsurvival , PSTR , PStrata , PSweight , psychmeta , psycho , PsychWordVec , psyntur , ptable , ptairMS , ptetools , PTXQC , PublicationBias , pubrplot , puff , PUlasso , puls , PUMP , PUPAK , PupilPre , PUPMSI , PureCN , pureseqtmr , pvaluefunctions , pvars , pvEBayes , pvLRT , PvSTATEM , pwrFDR , qad , qbinplots , qbrms , qcapower , qcQpcr , QCSimulator , qdap , qgcomp , qgcompint , qgraph , QI , qicharts , qicharts2 , qmd , qmtools , qPCRhelper , qPCRtools , qPLEXanalyzer , Qploidy , qpNCA , qPRAentry , qra , QRIpkg , qrlabelr , qshap , QsRutils , qsvaR , qte , qtkit , qtl2ggplot , qtl2pattern , qtl2pleio , quadraticSD , QuadratiK , quadVAR , quantbayes , quanteda.textplots , quantilogram , quantiseqr , quantkriging , QuantRegGLasso , quantro , quarks , QuESTr , quickOutlier , quickPlot , QuICSeedR , quid , quollr , QurvE , qvalue , qwraps2 , R.AlphA.Home , R.ComDim , r2dii.plot , r2glmm , R2sample , R3CPET , R4GoodPersonalFinances , r4lineups , r4pde , r4ss , r6qualitytools , RABR , RaceID , Racmacs , rACMEMEEV , rADA , RadEro , RadialVisGadgets , radiant.basics , radiant.model , radiant.multivariate , radsafer , RADstackshelpR , Radviz , rags2ridges , rai , RAIDS , rainerosr , rainette , RaJIVE , RALSA , randomForestExplainer , randomForestVIP , randomUniformForest , randotools , rankinPlot , raptools , raptr , raretrans , RARfreq , RaSEn , rassta , RastaRocket , rasterdiv , RAT , rater , rattle , RavenR , rawDiag , RawHummus , rawKS , RBaM , rbbnp , rbcc , Rbearcat , Rbec , RBesT , rBiasCorrection , rbin , rbioacc , rbiom , rblimp , rbranding , Rcan , rcartocolor , RCAS , RCaucTile , rcellminer , RcensusPkg , rCGH , RChASM , rChEA3 , RchivalTag , rciplot , RCM , RcmdrPlugin.RiskDemo , Rcollectl , RColorConesa , rcontroll , RcppCensSpatial , RCSL , rcssci , RCT , RCTrep , RCTS , Rcurvep , rd2d , rddensity , rddtools , rdlearn , rdmulti , rdrobust , RDS , rdss , rdstagger , Rdune , ReactomeGSA , ReactomePA , readyomics , reappraised , recalibratiNN , reconsi , RecordTest , REDI , redist , ReducedExperiment , ref.ICAR , refdb , refreg , refund , refund.shiny , refundBayes , RegEnrich , reghelper , RegimeChange , RegionalST , regioneReloaded , regr.easy , RegrCoeffsExplorer , regressinator , regrrr , regtomean , ReinforcementLearning , RelativeDistClust , Relectoral , reliabilitydiag , RelimpPCR , relsurv , remiod , REMixed , REN , RepeatedHighDim , Replicate , ReporterScore , ReportingTools , reportRmd , reproducer , rerddapXtracto , reReg , rescomp , reservoirnet , RESI , ResIN , reslr , RESOLVE , resourcecode , RestoreNet , restriktor , resumiR , ReSurv , retimer , retmort , RevGadgets , reviser , REXoplanets , rexposome , rextor , Rfastp , RFGeneRank , rFIA , rfisheries , rfm , rfPermute , rfriend , rfVarImpOOB , RGAP , rgbif , RGCCA , rgm , RGMM , rgnoisefilt , Rgof , RGraphics , RHC , rhierbaps , RHMS , ri2 , riAFTBART , ribiosPlot , RiboCrypt , RiboDiPA , ribor , ribosomeProfilingQC , rice , rict , RIdeogram , Riex , rifi , rifiComparative , RImagePalette , rimu , rinat , Rirt , riskCommunicator , riskdiff , RiskMap , riskRegression , riskscores , ritalic , RITAN , RIVER , RJafroc , rKIN , rKOMICS , RKorAPClient , rLakeHabitat , rlfsm , rliger , rmcfs , rmdd , RMeDPower2 , rmedsem , rmetalog , Rmfrac , RMixtComp , RMixtCompUtilities , rmlnomogram , rmoo , rms , rmsb , rmsBMA , rmsMD , RMSTpowerBoost , rmweather , RNAAgeCalc , rnaCrosslinkOO , RNAdecay , RNAmf , RNAmodR , RNAsense , RNAseqQC , RNAshapeQC , Rnest , rnmamod , Rnmr1D , rnrfa , roahd , roastgsa , robber , robin , robis , RobKF , RoBMA , robmedExtra , robomit , RoBTT , RobustFlow , RobustMediate , robustT2 , robvis , Robyn , rock , roclab , ROCModels , ROCnGO , ROCsurvcomp , rocvb , ROKET , RoME , romic , ropls , roptions , roroph , rotations , rotatogram , rPACI , Rpadrino , rPBK , rpcss , rphylopic , rplec , RplotterPkg , rpm , RPPanalyzer , RPregression , rprimer , RprobitB , Rprofet , rpsftm , RQdeltaCT , rQSAR , rrda , rreg , rrepast , rrobot , rrpack , RRPP , rrr , RRRR , rrtable , rrvgo , rSAFE , RSCAT , RSD , RSDA , rSDR , Rsearch , Rsgf , rshift , rsimsum , Rsmlx , RSP , rSRD , RSSL , RSSthemes , rstan , rstanarm , rstanemax , RStoolbox , rStrava , RTCGA , rtemps , rtestim , rtForecastEval , rTG , rticulate , RTL , rtms , RTNsurvival , Rtpca , rtpcr , rtrek , RTSA , RtsEva , RUCova , RuHere , RulesTools , ruminate , runcharter , rupturesRcpp , rusk , ruv , rvertnet , rwa , rxode2 , rYWAASB , sae4health , saemix , saens , saeRobust , saeSim , saeTrafo , SAEval , SafeVote , sageR , salmonMSE , SAME , sampbias , sampcompR , sampleClassifier , samplr , SAMprior , SangerTools , sansa , santaR , sapfluxnetr , saros , satuRn , savvyPR , sbm , SC3 , scafari , scanMiR , scanMiRApp , scAnnotatR , scatr , scatterbar , scatterHatch , scattermore , scBFA , scBubbletree , scClassify , sccomp , sccore , scCustomize , SCDA , scDataviz , scDD , scDesign3 , scDiagnostics , scDotPlot , scdtb , scECODA , scenfire , scf , scFeatureFilter , SCFMonitor , scGate , SCGLR , scGPS , SChangeBlock , scHiCcompare , scholar , SchoolDataIT , scHOT , scider , scifer , scimetr , scipub , scistreer , scitb , scITD , scLANE , scLang , scmap , scMappR , scMET , scMetaTraj , scMitoMut , scmSpillover , scMultiSim , SCnorm , Sconify , SCOPRO , scorecard , scorecardModelUtils , SCoRES , scoringutils , scp , scPairs , scpi , scPipe , scplot , scpoisson , scqe , scQTLtools , scR , ScreenR , scregclust , scRNAseqApp , scRNAstat , scruff , scrutiny , scSpatialSIM , scTensor , scTGIF , SCtools , scToppR , sctransform , scTreeViz , scTypeEval , sdamr , sdcMicro , SDCNway , SDGdetector , SDModels , SDMtune , SEAHORS , seahtrue , searchAnalyzeR , SeaSondeR , SECFISH , secsse , sectorgap , sedproxy , see , seecolor , segclust2d , segen , SEI , SEIRfansy , SelfControlledCaseSeries , semboottools , semEffect , semfindr , semhelpinghands , semicmprskcoxmsm , semlbci , SemNeT , SEMPLR , semtree , sendigR , senseweight , SensIAT , sensitivity , SensMap , sensobol , SensoMineR , SentimentAnalysis , sentimentr , sentometrics , SepTest , seqCAT , seqcombo , SeqFeatR , seqHMM , SeqSQC , SEQTaRget , SEraster , serocalculator , serofoi , SerolyzeR , serosv , SeroTrackR , sesame , Seurat , SeuratExplorer , sffdr , sfhelper , sfhotspot , sfislands , sgboost , sgd , sglg , sglr , sgmodel , sGMRFmix , sgplot , sgraph , sgsR , sgstar , shadowtext , shadowVIMP , SHAPforxgboost , shapley , ShapleyOutlier , shapper , shapviz , SHARK4R , SHELF , ShellChron , sherlock , shewhartr , shinipsum , shinyCohortBuilder , shinyDSP , shinyepico , ShinyItemAnalysis , shinyKGode , shinyloadtest , shinyML , shinymrp , ShinyQuickStarter , shinySbm , shinystan , shinyTempSignal , shoredate , shorm , shortIRT , shorts , SIAmodules , sicegar , sidier , Sie2nts , sievePH , SiFINeT , sights , sigminer , Signac , signatureSearch , signeR , signifinder , siland , Silhouette , sim.BA , SIMAT , SimBaRepro , SimBIID , SimBu , SimCorrMix , simET , simevent , SimKid , simlandr , SIMle , SimMultiCorrData , simPH , simplecolors , SIMPLICA , SimplicialComplex , SimplyAgree , simpowa , simrel , simulariatools , simulateDCE , SimuRg , sincell , SingleArmMRCT , singleCellHaystack , SingleCellSignalR , singleCellTK , SingleMoleculeFootprinting , singscore , SIP , SISIR , sistmr , sitar , sitePath , sitepickR , SixSigma , SiZer , sjPlot , sjSDM , SkeletalVis , sketchR , skewlmm , skipTrack , skytrackr , slalom , SLCARE , SleepCycles , sleepwalk , SLEMI , slendr , Slick , SlideCNA , SlimR , SLOS , SlotLim , smallsets , SmartEDA , smartid , SmartPhos , SMASH , smdi , smimodel , SMITE , smoof , smoothic , SmoothPLS , smoppix , smplot2 , sMSROC , snahelper , snap , snazzieR , snfa , snpAIMeR , SNPannotator , SNPassoc , SNPfiltR , SNPhood , snplinkage , sNPLS , Sobol4R , socialdrift , socialh , softwareRisk , soilFlux , SoilManageR , soiltestcorr , soiltillr , SomaDataIO , SomaticSignatures , SOMbrero , SOMNiBUS , SOMnmR , sonicscrewdriver , SONO , sorvi , sosta , SoupX , SouthParkRshiny , SpaCCI , SpaceMarkers , spacemodR , SpaceTrooper , spacexr , SPACO , spada , Spaniel , SpaNorm , spareg , SPARRAfairness , sparrow , sparseDFM , sparsediscrim , sparsegl , SparseSignatures , sparsevar , SPARTAAS , spaSim , SpatFD , spatgeom , spatialAtomizeR , SpatialCPie , spatialDE , spatialFDA , spatialGE , spatialHeatmap , spatialLIBD , SpatialOmicsOverlay , SpatialRDD , spatialRF , spatialsample , spatialTIME , spatialwarnings , SpatMCA , SpatPCA , spatPomp , spcosa , spDates , speakr , speaq , speccurvieR , specieschrom , speckle , specr , spect , spectacles , spectrakit , SpectralClMixed , spectralR , Spectran , Spectrum , spEDM , spef , SPEI , spFSR , SPIAT , SPICEY , spicyR , spikeSlabGAM , spiky , spillR , spinBayes , spind , spinebil , spinifex , spinner , spiro , SpliceImpactR , SpliceWiz , splinemixmeta , splineplot , splinetree , SPLINTER , splithalf , SplitKnockoff , splmm , splutil , spmoran , SpNeigh , spNetwork , SPONGE , spongecake , spooky , spork , sport , SportMiner , sportyR , SpotClean , SPOTlight , spotoroo , SpotSweeper , Spower , SppTrend , spqdep , sprex , SPRT , sprtt , spStack , spsur , SpTe2M , sptotal , SQIpro , SQMtools , squallms , squant , squat , SqueakR , squid , sr , sRACIPE , sreg , sRNAGenetic , srpi , ss3sim , ssd4mosaic , SSDM , ssdtools , ssifs , SSIMmap , ssMousetrack , ssMRCD , ssMutPA , SSP , SSplots , SSVS , stabiliser , stability , StabilizedRegression , stabilo , stacks , STADyUM , staggR , standardlastprofile , standR , StanMoMo , starma , starry , starvz , statAfrikR , statAPA , statar , statcheck , statConfR , statdecideR , statebins , STATegRa , StatescopeR , statforbiology , statgenGWAS , statgenGxE , statgenHTP , statgenIBD , statgenMPP , statgenSTA , Statial , statisR , StatRank , statsr , StatTeacherAssistant , STCCGEV , STCYP , STDistance , stdmod , stelfi , StempCens , steppedwedge , StepReg , StepRegShiny , stepssurvey , stevemisc , stevethemes , stJoincount , STMotif , STMr , stochvolTMB , stodom , stPipe , stpp , stppSim , strand , StratifiedMedicine , STraTUS , stray , StreamCatTools , stRoke , StroupGLMM , structSSI , structToolbox , strvalidator , sts , studentlife , stxplore , SubCellBarCode , SubgrpID , subscreen , subSeq , sugarglider , SUITOR , sulcimap , sumer , summata , SUMMER , SUMO , sumvar , superb , SuperCell , Superpower , supportR , sure , suRface.analytics , surfaltr , SurfR , SurprisalAnalysis , SurrogateParadoxTest , SurrogateRank , SurrogateSeq , surtvep , survalis , survdnn , survdt , surveil , survex , survextrap , surveydata , surveyexplorer , surveyPrev , surveysd , SurveyStat , survidm , survinger , SurvivalTests , survivoR , survkl , survobj , survParamSim , survSens , survstan , susieR , sValues , svars , SVARtca , SVEMnet , svgedit , SVMMaj , SVP , svplots , svyCausalGLM , SWATH2stats , swfscMisc , swimplot , swissparl , switchde , SWTools , symphony , symptomcheckR , synergyfinder , SynergyLMM , synlet , synr , syntenet , syntenyPlotteR , SynthETIC , synthpop , sysAgNPs , sysid , Sysrecon , systemPipeR , systemPipeShiny , systemPipeTools , T4cluster , tabledown , tablesgg , tabnet , tabr , tabularmaps , TADCompare , tagtools , TailClassifier , TailID , talkr , tall , tame , TangledFeatures , TargetDecoy , tashu , taskqueue , tastypie , TaxaNorm , taylor , TBA , TBSignatureProfiler , TCGAbiolinks , tcgaViz , tci , TCIU , tcpl , tcplfit2 , TCseq , TDAkit , TDAstats , teal.modules.clinical , teal.widgets , teamcolors , tectonicr , tEDM , telemetR , TELP , telraamStats , TENET , tensorBSS , tepr , tern , tern.mmrm , terrainr , TesiproV , testarguments , testcorr , TestDimorph , TestGenerator , tetraclasse , tetragon , text , text2sdg , texter , TextMiningGUI , tfrmt , tgamtheme , TGST , theftdlc , thematic , ThermalSampleR , TheseusPlot , TheSFACE , thief , ThinkingGrid , thinkr , thisplot , tickr , tidyactuarial , tidyAML , tidybayes , tidyBdE , tidybins , tidybulk , tidyCDISC , tidychangepoint , tidycmprsk , tidycomm , tidyCoverage , TidyDensity , tidydice , tidydr , tidyEdSurvey , tidyestimate , tidyexposomics , tidyFlowCore , tidyfun , tidygam , tidygate , tidyGenR , tidyILD , tidylearn , tidyLPA , tidyMC , tidymodels , tidypaleo , tidyplots , tidypopgen , tidyposterior , tidyquant , tidysdm , tidySEM , tidyseurat , tidySingleCellExperiment , tidySpatialExperiment , tidyspec , tidySummarizedExperiment , tidysynth , tidyterra , tidytlg , tidyusmacro , tidyverse , tidyvpc , tidywater , tikatuwq , tilemaps , timbeR , timeOmics , timeplyr , timetk , TimeVizPro , tintin , tinyarray , tinyscholar , tinythemes , tip , tipmap , tipsae , tipse , TITAN2 , Tivy , tldr , TLMoments , tLOH , tlsR , TmCalculator , tmod , tmt , tna , TOAST , tomoda , tomoseqr , toolmaRk , TooManyCellsR , TOP , topconfects , TopDom , topdownr , topics , TopKSignal , topologyR , topolow , toponym , topr , torchMAUM , tornado , toscca , TOSTER , TOU , toxEval , ToxicoGx , toxpiR , toxSummary , TPP , TPP2D , tracee , track2KBA , trackeR , trackopt , TrackTrap , tradeoffaucdim , tradepolicy , tradeSeq , Trading , trafficCAR , traineR , traitstrap , TrajectoryGeometry , trajmsm , transcriptogramer , transcriptR , transforEmotion , transformerForecasting , transite , transmem , transmogR , transPlotR , TransProR , traumar , trawl , treeclim , treeclimbR , treeDA , TreeDiagram , treefit , treeheatr , treekoR , treemap , treemapify , treeshap , treesliceR , tReeTraits , trekcolors , trelliscopejs , trendtestR , trialr , TrialSimulator , tricolore , tricycle , TrIdent , tRigon , trinROC , triptych , tRNA , trtswitch , TSAR , TSCAN , TSCS , tscv , tsdataleaks , TSDFGS , tseffects , tsentiment , tsfgrnn , tsfknn , tsforecast , tsgc , tsiR , tsnet , TSS.RESTREND , TSsmoothing , tsviz , tswge , TUFLOWR , tune , turkeyelections , tvm , tvmediation , TVMM , TVMVP , TVTB , twang , twig , twoddpcr , TwoDiRef , twomodeclusteringGA , TwoPhaseCorR , TwoRegression , TwoStepSDFM , twowaytests , txshift , ubair , UBayFS , ubiquity , ubms , UComp , UCSCXenaShiny , ufs , ulrb , ultrapolaRplot , Umatrix , ume , UMI4Cats , umiAnalyzer , umx , UncDecomp , UNCOVER , unfold , unhcrthemes , unikn , UniprotR , unityForest , universalmotif , unsum , unsurv , unusualprofile , uotm , UpAndDownPlots , updog , UpDown , UPG , upset.hp , UpSetR , Upsilon , upstartr , USE , uteals , utile.visuals , utsf , vacalibration , vaccine , vaccineff , vachette , vald.extractor , valdrViz , VALERIE , valhallr , valr , valytics , vangogh , vannstats , VARcheck , VarCon , VarSelLCM , vaxineR , vayr , VBphenoR , vbracket , vchartr , vcmeta , vctsfr , VDAP , vDiveR , VDJdive , VDSM , vecmatch , vectorsurvR , veesa , vegetablesSriLanka , VennDetail , vennDiagramLab , VennItem , venny , vhcub , vibass , vici , vidger , viewpoly , vigicaen , vimixr , vimpclust , VIMPS , vip , viridis , ViroReportR , virtualPollen , Virusparies , visa , viscomp , visdat , ViSe , ViSEAGO , VisitorCounts , vismi , vissE , VISTA , vistime , vistributions , VisualizeSimon2Stage , visualpred , visvaR , visvow , visxhclust , vital , vivainsights , vivaldi , vivid , vivo , VizModules , VizTest , VLTimeCausality , vmeasur , vmrseq , vmsae , voi , voice , voiceR , volatilityTrader , volcano3D , volcanoPlot , volker , voluModel , VoronoiBiomedPlot , voteogram , VOWR , Voyager , vpc , vsn , VSOLassoBag , vsp , VWPre , wacolors , wactor , waetr , wakefield , walkboutr , walker , walrus , waou , WAreg , washi , WASP , WaterBalanceR , waterfalls , Wats , wavClusteR , waves , wdiexplorer , WeatherSentiment , webr , webSDM , weed , weibulltools , weightedsurv , WeightIt , weird , weitrix , welo , Westerlund , wevid , wgaim , whatifbandit , WhatsR , whippr , whoa , whomds , wideRhino , widr , wiggleplotr , wikiprofiler , wilson , windows.pls , wingen , WINS , wjake , WLogit , WMAP , WordListsAnalytics , wordmap , workflowsets , WorldMapR , WormTensor , worrrd , wpa , wpeR , wpm , wppExplorer , wql , WQM , wqspt , wqtrends , wrappedtools , WrensBookshelf , WRI , wrictools , WRSS , wsjplot , wsMed , WVPlots , xadmix , XAItest , XDNUTS , xenLite , Xeva , xgrove , xgxr , xiacf , XINA , xmrr , xpect , xpose.nlmixr2 , xpose.xtras , xray , xvm , xxdi , XYomics , yamlet , YatchewTest , ycevo , YEAB , yorkr , ypr , yrnd , yuimaGUI , zcurve , zebu , zenith , ZetaSuite , zFPKM , ZIDW , ZIHINAR1 , zitools , ZonationR , ztils , ztype
Reverse Suggests
abctools , abd , abn , aboveR , accessibility , acledR , activatr , activityCounts , AdaptGauss , adaptr , adelie , adept , adformR , adjoin , adjustedCurves , admixr , adoptr , adw , AeroEvapR , afcolours , afdx , afex , affiner , aggregateBioVar , agridat , ags , aifeducation , aire.zmvm , airGR , aisdk , ALDEx2 , aldvmm , alfred , algebraic.mle , AlgeriAPIs , AlleleShift , alone , amadeus , AMAPVox , amazonadsR , amazons3R , amazonspR , ambiorix , ambiR , ambit , ameras , AMISforInfectiousDiseases , amp.dm , amp.sim , AmpGram , AMR , amt , animint2 , ankiR , anscombiser , antaresViz , AntibodyForests , antitrust , ao , aopdata , aorsf , apa7 , api2lm , appeears , appleadsR , appsflyeR , apsimx , AquaBEHER , arcgeocoder , archetypes , archivist , arctools , arf , ArgentinAPI , aricode , aridagri , ARPobservation , arthistory , ARTool , artpack , ARUtools , ascotraceR , ashapesampler , ashr , assemblykor , AssociationExplorer2 , ASURAT , asymptor , ATbounds , atime , atrrr , aum , autothresholdr , av , avesperu , avilistr , avocado , awinR , awst , babette , bacondecomp , bage , bagyo , bakeoff , bambu , banditpam , bang , bangladesh , Banksy , baRulho , BAS , baselinenowcast , basemaps , BaseSet , basksim , baskwrap , BatchGetSymbols , Battlefield , BayesBrainMap , BayesDecon , BayesDissolution , BayesianDisaggregation , bayesianOU , bayesplay , bayespmtools , bayesPO , BayesPPD , bayesRecon , bayesSSM , bayestestR , bayesTFR , bbk , bbmle , bbssr , bcdata , bcf , bcmaps , bcp , bdlnm , beer , belg , BEMPdata , bench , benchmarkme , benthos , bertopicr , bestNormalize , BetaBit , BGmisc , bgms , bib2df , bidask , BiDimRegression , bidser , BigDataStatMeth , bigPCAcpp , bigPLSR , BIGr , bingadsR , binom , binsegRcpp , bioassayR , biobroom , BiocBuildReporter , BiocHail , BioCor , biogas , biogram , Bioi , bioLeak , BioMonTools , BioMoR , BioQC , biostat3 , BioTIP , BioWorldR , biplotEZ , BiplotML , BIS , bistablehistory , bitmexr , bivarhr , blackmarbler , BlandAltmanLeh , blastula , blends , BLSloadR , blvim , bmm , bnns , bnRep , bodenmiller , boe , BOJ , bootCT , bootkmeans , bootmlm , bootUR , BORG , borrowr , brainGraph , brand.yml , BrazilDataAPI , breathteststan , brickset , bridgedist , brokenstick , broom , broom.helpers , broom.mixed , brotli , bruneimap , brunnermunzel , BSDA , bsitar , bslib , bssm , bsub , btergm , bugphyzz , bulletcp , bunddev , calba , campaignmanageR , canadamaps , cancensus , CancerGram , Canek , cansim , canvasXpress , CAOP.RAA.2024 , CardioDataSets , caRecall , cartographer , casimir , CatastRo , catregs , causalBatch , cbbinom , ccdR , CDatanet , CDMConnector , CellBench , cellmigRation , celltrackR , censcyt , censo2017 , censobr , Census2016 , centerline , CEOdata , CepalStatR , cercospoRa , cfbfastR , CFM , cfr , CGGP , cgmguru , ChangePointTaylor , CharAnalysis , checkmate , cherryblossom , ChileDataAPI , chilemapas , ChillModels , ChinAPIs , chiOpenData , cholera , chomper , choroplethrMaps , chouca , chron , cia , ciftiTools , CircaCP , CircularSilhouette , cito , ciTools , civis , clap , clayringsmiletus , cld , cleaner , clidatajp , clinCompare , clinTrialData , clinUtils , CLLmethylation , cloneRate , clugenr , clusternomics , ClusterSignificance , ClustMC , clustNet , clustSIGNAL , clustTMB , cmhc , cnefetools , cnmap , CNVreg , coda.base , codalm , codingMatrices , codyn , CohortCharacteristics , CohortConstructor , CohortGenerator , CohortSurvival , CohortSymmetry , collapse , collateral , ColombiAPI , ColOpenData , colorednoise , colorify , ColorNameR , colorspace , Colossus , cols4all , comets , COMMA , command , COMPASS , complexlm , COMPoissonReg , compositional.mle , comtradr , concordexR , concstats , CondCopulas , condiments , confcons , confintROB , conformalbayes , conformalForecast , ConformalSmallest , connectapi , connector , ConsensusOPLS , consensusOV , consensusSeekeR , CONSTANd , constellation , constructive , contactdata , contagionchannels , container , contrast , CopernicusClimate , copre , copulaSim , correlation , cosmic , cosmosR , counterfactuals , couplr , covafillr , covidnor , cowfootR , cpp11 , cpsvote , crandep , cre.dcf , cricketdata , crimedatasets , crosstable , crosstalk , crs , crsuggest , crystract , csdata , cSEM , csquares , cstime , CTD , ctxR , curatedAdipoChIP , curatedAdipoRNA , CuratedAtlasQueryR , curatedPCaData , cvdprevent , cvequality , cxr , cyclomort , Cyclops , czechrates , DAISIE , damAOI , DAPAR , datacommons , datamods , datamuseum , DataQualityDashboard , dataresqc , datarobot , datasauRus , dataSDA , datawizard , datplot , dawaR , daymetr , dcce , ddplot , debkeepr , DecisionDrift , decisionpaths , DeclareDesign , deconvolveR , deconvR , decorrelate , decoupleR , deepdep , delimtools , deltatest , DemoKin , DenoIST , densityarea , densvis , denvax , DepInfeR , depmap , derfinder , derivmkts , descstat , designr , desirability2 , desla , detrendr , DEXiR , DGEobj.utils , dggridR , dials , DiDforBigData , diffuStats , DigestiveDataSets , DImodelsMulti , dimRed , Dino , dint , DirectEffects , directlabels , disaggR , DisaggregateTS , disclapmix , discord , discrim , diseasystore , DisImpact , dispositionEffect , distfromq , distributional , DiversityStats , divvy , DMCfun , DNEA , docorator , dodgr , domir , dormancy , DOTSeq , dpcR , dplyr , DPQBootstrap , dpseg , drake , drawer , DrBats , DrData , drmeta , droll , DRquality , DrugExposureDiagnostics , drugTargetInteractions , DrugUtilisation , dsb , dscore , DSFM , DSjobtracker , dsp , DTEBOP2 , dtrackr , duckspatial , DyadRatios , dynamicpv , dynamicSDM , dynConfiR , dynutils , earthtones , easystats , EbayesThresh , ebirdst , ebrahim.gof , ec50estimator , ecb , Ecfun , echo.find , ecoCopula , ecolRxC , econdataverse , economiccomplexity , ecopower , ecorisk , ecostats , ecoteach , ecotourism , ecotox , ecotraj , edfinr , edfReader , edgarWebR , edge , educabR , educationR , eemR , efdm , EFDR , EFM , EHR , ehymet , eia , eiCircles , eiopt2 , ElectDecomp , EloOptimized , embed , emmeans , EMMIXmfa , emphatic , emuR , enrichViewNet , enrichwith , eph , epialleleR , epicasting , epichains , epidatr , epidm , epigraphdb , EpiInvert , epiparameter , EpiPvr , epiR , EpiSignalDetection , epitrix , EpiTxDb , eq5d , equatiomatic , ergm.multi , errors , esetVis , EstemPMM , ethiodate , etl , etm , etwfe , europepmc , evaluate , evidenceratio , EviewsR , ewceData , exact2x2 , ExactVaRTest , exdqlm , export , expss , ExtDist , extras , extrasteps , eyelinker , f1dataR , fable.prophet , facebookadsR , facebookleadsR , facebookorganicR , facerec , factory , fakir , familiar , fastcpd , fastei , fastglmpca , fastMatMR , fastqrs , fastRanges , fastRhockey , fcaR , FDboost , fddm , fec16 , feisr , fermicatsR , fetchGoogleAnalyticsR , fetchSalesforceR , fetwfe , FFdownload , ffm , fgeo.analyze , finalsize , findSVI , fio , FIRM , fishdata , fishmechr , fitbitScraper , fitdistrplus , fitHeavyTail , fitODBOD , fitzRoy , fivethirtyeight , fixest , fjoin , flacco , flassomsm , flexrsurv , flextable , flightsbr , FLOPART , flowTime , fluxfinder , FlyingR , fma , fmds , fmesher , FMM , fmrihrf , fMRIscrub , fMRItools , fmx , forcats , ForCausality , forceR , FORD , forestBalance , forrel , forstringr , forwards , FossilSim , fourierin , fractional , framework , fredr , frenchCurve , frenchdata , frequencyConnectedness , FRESA.CAD , FSelectorRcpp , FuelDeep3D , functiondepends , funData , funrar , funtimes , furrowSeg , fuser , FusionLearn , fuzzyjoin , fuzzystring , fwlplot , fwtraits , gameR , GapAnalysis , gapminder , gasanalyzer , gcatest , gcplyr , GDAdata , gear , gemma.R , gender , geneplast , GeneralizedWendland , GENESIS , genieBPC , GenomicDataCommons , geoAr , geobounds , geobr , geocodebr , geocomplexity , geofi , geohashTools , GeometricMorphometricsMix , geoprofiler , GeoThinneR , GeoTox , GeRnika , GetBCBData , GetDFPData2 , GetFREData , GetLattesData , GetQuandlData , GetTDData , ggeffects , ggversa , ghcm , ghibli , ghypernet , Gifi , gifski , GIFT , GillespieSSA2 , giniVarCI , gips , giscoR , git2rdata , glm.predict , GLMcat , glmGamPoi , glmmTMB , glmpca , gofigR , golfastr , googleadsR , goSorensen , gplite , graphicalExtremes , graphicalMCP , graphlayouts , grates , gravmagsubs , Greg , grepreaper , gridDebug , gridExtra , gridify , gridmicrotex , gridpattern , GROAN , groupdata2 , GroupSeq , growR , growthcurver , growthrates , gsClusterDetect , gsDesign2 , gsDesignNB , GSgalgoR , gsignal , gsloid , GSODR , gstat , GSVA , gt , gtable , gtfs2emis , gtfsrouter , gtfstools , guardianapi , Guerry , GulFM , gutenbergr , gVenn , h2o , h3jsr , h3sdm , habtools , hal9001 , handwriterRF , Haplin , happign , harrietr , havel , hbbr , HCATonsilData , hdbayes , hdcate , HDCytoData , hdfqlr , HDiR , HDShOP , headliner , healthatlas , healthmotionR , heaping , heddlr , helsinki , heplots , hereR , heritable , hermiter , heuristica , hexDensity , hexify , HGDMr , HIBAG , HiCPotts , highcharter , highOrderPortfolios , hilbertSimilarity , HistData , historydata , hmclearn , HMP16SData , HMP2Data , hmrc , holodeck , hoopR , Horsekicks , hpa , hrf , htaBIM , HTLR , htmxr , httkexamples , hubeau , hubEnsembles , HuBMAPR , hues , HumanRetinaLRSData , hutils , huxtable , HVP , hwep , hybridts , hypergeo2 , hystReet , ialiquor , ibdsegments , Ibex , ibger , ibmdbR , icarus , icr , ICvectorfields , idiogramFISH , ie2miscdata , ifo , igblastr , igcop , IgGeneUsage , igoR , iGraphMatch , igrf , IHW , ImageArray , imageFeatureTCGA , imagefluency , imager , imageTCGAutils , imaginator , imgrec , immApex , immLynx , Immutables , imputeFin , imuf , incidence2 , IncidencePrevalence , incubate , IndiAPIs , IndonesiAPIs , ineAtlas , infectiousR , infocausality , infoelectoral , inkaR , inlabru , INLAspacetime , INLAvaan , insee , instagramadsR , installr , interfacer , interp , inters , InterVA5 , iNZightPlots , IPEDS , iperform , ipolygrowth , ipumsr , irg , irt , iscream , isoband , isocalcR , isocat , ivmte , ivreg , JacobiEigen , JapanAPIs , jazzPanda , jetty , jgd , jlmerclusterperm , jmSurface , jmvcore , JointAI , jointest , jSDM , jumps , junctions , kalmanfilter , kamila , kDGLM , kdry , Keng , keras , keras3 , kerasnip , kergp , kernstadapt , kfigr , khroma , kidsides , kim , kimfilter , kinematics , kiwisR , kko , klsh , kmc , knitrBootstrap , L2E , labelr , LAGOSNE , Lahman , laOpenData , latentFactoR , latex2exp , latrend , lay , lda , learningtower , LearnNonparam , letsR , lfa , lgrdata , LifeTableFertility , lightsf , LikertMakeR , lillies , limonaid , limorhyde , limorhyde2 , LimROTS , linkedInadsR , lionfish , LKT , LLMAgentR , LLMR , lme4 , lmls , LMMsolver , LocalControl , LocalCop , localIV , lofifonts , LogisticRCI , logitnorm , logitr , lognorm , logolink , longevity , longmixr , loo , LOPART , lorbridge , lotri , lphom , lrd , LSMRealOptions , lspline , LTASR , lutz , luz , lzstring , macleish , MAd , maddison , MaddisonData , madrat , magclass , magick , magrene , maicplus , mailchimpR , makeit , MANOVA.RM , mapchina , mapi , mapsapi , mapscanner , mapSpain , maq , marginaleffects , margins , marked , marketr , markets , markovmix , marqLevAlg , marquee , MARSS , MASSExtra , matchingMarkets , maths.genealogy , matrixStats , matsindf , maxbootR , mbg , mcbette , mccount , mcmodule , MD2sample , MeasurementDiagnostics , MedDataSets , medExtractR , medicare , MedLEA , MedxR , meetupr , melt , memor , MerfishData , metabinR , metafrontier , metalite , metalite.table1 , metaLong , MetaStan , meteospain , metevalue , methcon5 , methylCC , metrosp , MexicoDataAPI , mfGARCH , mgc , MGDrivE2 , MGLM , MGnifyR , Mhorseshoe , MIAmaxent , miaSim , miaTime , miceFast , micemd , microbenchmark , MicrobiomeBenchmarkData , MicroMoB , MicSim , micsr , midasHLA , midnight , midr , mifa , miic , mikropml , milr , miniPCH , misl , missForestPredict , missMethods , missoNet , mist , mistr , mixdir , MixMatrix , MixStable , mlmodels , mlogit , mlr3pipelines , mlr3resampling , mlr3torch , mlrMBO , mmb , mmrm , mnirs , modelbased , modeldata , modeldiagramR , modelr , modelsummary , modisfast , MODISTools , ModStatR , MOEADr , momentuHMM , mongolite , mongolstats , moonBook , morphemepiece , morrowplots , mort , mortAAR , mosaicData , mousetRajectory , move , move2 , mpathsenser , mqriskR , mrddGlobal , MSA2dist , MSG , mstate , mtaOpenData , mthapower , MTLR , MTPS , mtsta , MultiBD , multifunc , multilevelmod , MultiscaleSCP , multitool , multiverse , munsell , muSpaData , muttest , mvGPS , mvinfluence , mvMAPIT , mvSLOUCH , mvtweedie , mwshiny , MyoScore , nadir , nanotime , naryn , naspaclust , nativeORT , NBAloveR , NBAMSeq , nbapalettes , nbTransmission , nc , ncdfCF , ndi , neotoma2 , nestedLogit , NestLink , net4pg , NetMix , netplot , netSmooth , nett , networkABC , NeuralEstimators , neurobase , NeuroDataSets , neuroSCC , NewWave , ngboostForecast , nhanesA , nhanesdata , nhdplusTools , nhppp , NHSRdatasets , NHSRwaitinglist , nic , nichetools , NitrogenUptake2016 , nlmixr2 , nlmixr2lib , nlraa , nls.multstart , nlsr , NlsyLinks , nLTT , NMcalc , NMdata , NMsim , nn2poly , nnSVG , NobBS , nodeSub , nominatimlite , nomisdata , nosoi , NPARC , npdsim , NPLStoolbox , NPRED , npsurvSS , NRMSampling , nseq , nswgeo , ntfy , numberofalleles , nuts , NVAR , nycOpenData , nysOpenData , o2ools , OBIC , oblicubes , occupancy , oddsapiR , OECD , officedown , officer , ohenery , ohsome , olr , OmicNavigator , OmnipathR , omock , OmopConstructor , OmopSketch , OmopViewer , onbabynames , OncoDataSets , openaiRtools , openalexR , opendatatoronto , OpenMx , openNCAI , OpenRange , openrouteservice , OpenSpecy , openxlsx2 , OptCirClust , optimizeR , optimLanduse , OptimModel , optimParallel , optiSel , OPWeight , ordinalClust , orthosData , outcomerate , outlierensembles , overtureR , OVESEG , oxcAAR , oystermapR , ozbabynames , paar , packcircles , pacta.loanbook , pacu , padma , padr , pafdR , pagenum , pagoda2 , paisaje , paleoDiv , palette , paletteer , palettetown , palimpsestr , palmerpenguins , pals , pander , papaja , parallelDist , parameters , ParamHelpers , paramix , paramtest , PaRe , parSim , PartialNetwork , partycoloR , passt , pastclim , Path.Analysis , PatientGenerator , PatientLevelPrediction , PatientProfiles , PBImisc , pbm , pcalg , pcaMethods , pcFactorStan , pcpr , pct , pder , pdi , PDQutils , pdSpecEst , pdxTrees , peakCombiner , PeakError , PeakSegDisk , PeakSegDP , PeakSegJoint , PeakSegOptimal , PEAXAI , pedalfast.data , penetrance , PenguinR , penppml , perccalc , PerformanceAnalytics , periscope2 , permutes , PeruAPIs , peruflorads43 , perumammals , phangorn , PheCAP , PhenotypeR , PHENTHAUproc , phoenix , photobiologyFilters , photobiologyInOut , photobiologyLamps , photobiologyPlants , photobiologySensors , phsmethods , phylosamp , phylosem , phyr , PiC , PICB , picohdr , piecepackr , pillar , pinterestadsR , pipeflow , pipetime , pipr , pivotea , pivottabler , pixarfilms , pixieweb , pixr , pkgnet , pkmapr , PKNCA , PL94171 , planet , plantTracker , PlatformDesign , platowork , pleLMA , plnr , PlotFTIR , plotgardener , plotHMM , plotscale , plotscaper , plspm , plyranges , pmcalibration , pminternal , PNADCperiods , PNWColors , poem , pointblank , poldis , polle , pollen , pollster , Polychrome , polymapR , polyRAD , pomp , pompp , PoolDilutionR , poolHelper , popReconstruct , poputils , portalr , portvine , posologyr , posterior , PosteriorBootstrap , power.transform , PPforest , pqsfinder , PRDA , pre , predictset , PredTest , prenoms , prepost , prepplot , presenter , presize , prevtoinc , primarycensored , pROC , procs , profr , ProjectTemplate , projmgr , propensity , ProteinGymR , ProteoDisco , PRROC , psborrow2 , PSCBS , psd , pseudohouseholds , pseval , PSpower , psychonetrics , public.ctn0094data , PublicationBiasBenchmark , PubMatrixR , PulmoDataSets , purgeR , pwlmm , pwr , pysd2r , qatarcars , qcmetrics , QFeatures , qlifetable , QSutils , quadcleanR , quadkeyr , quallmer , qualmap , qualvar , QuantBondCurves , quantdr , quantities , quarto , quartose , questionr , queuecomputer , quoradsR , R2admb , R2D2ordinal , r2pptx , r2rtf , r3PG , R3port , r5r , R6P , radarBoxplot , radEmu , Rage , ragtop , RAINBOWR , ramr , RaMS , RandomForestsGLS , RandomWalker , rangeMapper , rankrate , rareflow , RAREsim , rasterList , rasterpic , rasterVis , raw , raybevel , rayshader , rb3 , rbi , rbiodatacr , rbmi , rbmiUtils , rbrsa , rcbayes , rCISSVAE , rcldf , RcmdrPlugin.EZR , rco , rcoins , Rcompadre , RcppHungarian , RcppZiggurat , RCzechia , rdataretriever , RDesk , RDHonest , rdhs , rdi , RDML , RDSsamplesize , rdtLite , readabs , readaec , readMDTable , readmit , readrba , readsdr , rearrr , recipes , Recon , recount , recountmethylation , reda , redditadsR , REddyProc , redistmetrics , redlist , regionReport , regions , registr , ReliabilityTheory , relliptical , remap , remotePARTS , rempsyc , repfun , reporter , repoRter.nih , representr , ReproStat , reservr , retrodesign , retrofit , retroharmonize , reval , revdbayes , reveneraR , Revticulate , rex , RFAE , rFAMS , rfars , rfordummies , RforProteomics , RGENERATEPREC , Rglottography , rgoslin , rgph , rhdf5 , rhosa , ribd , ricu , ridgetorus , riem , Rilostat , risk.assessr , riskParityPortfolio , RiskScorescvd , riverconn , rivr , rixpress , rKolada , rLFT , Rlgt , rLifting , rmacrostrat , rmcorr , rmdfiltr , rmdformats , rmdpartials , rnaturalearth , rnbp , rnnmf , rnpn , roadDB , RoBSA , robust2sls , robustbase , robustlmm , robustmatrix , rODE , roloc , rosario , rosmium , roundwork , rpact , rPandas , rpanel , rpf , rplanes , rpmodel , rPref , RQEntangle , rrcov3way , rredlist , RRgeo , RRphylo , rrscale , rsample , rSDI , rsofun , rSPDE , rsppfp , rsprite2 , rstac , RStanTVA , rstpm2 , RSTr , rsurvstat , rsvd , rsvg , rsyncrosim , rtemis , Rthingsboard , rtiddlywiki , rtide , rtmsEcho , rTPC , RTransferEntropy , rTRM , rTwig , Ruido , runstats , rurality , rvec , rvinecopulib , RWmisc , s20x , S4DM , saccadr , sadists , saeHB.TF.beta , SAGMM , salem , salesforcer , SAMBA , sameplot , sampledatasets , SAMtool , sand , sarks , sbim , SC2API , scales , scanstatistics , ScatterDensity , sccic , SCDB , scDblFinder , scdhlm , scDiffCom , scFeatures , scGraphVerse , schrute , SCIBER , scico , scimo , scmeth , scone , scoringRules , scPCA , SCpubr , scry , scviR , SDaA , sdmpredictors , sdmTMB , sdmvspecies , sdsfun , seer , seewave , segregation , seirMFG , SelectBoost.beta , SelectBoost.gamlss , selectKSigs , semEff , SemNetDictionaries , senatebR , sentopics , seqhandbook , Seqtometry , seqtrie , sequenceR , seqwrap , seriation , SETA , SEtools , SeuratObject , sf , sfcentral , sfclust , sfcr , sfd , sfdep , sfi , SFM , sfnetworks , sftime , sftrack , shades , shannon , shapr , shidashi , shiny , shiny.fluent , shiny.tailwind , shinybrms , shinyjqui , shinymeta , shinyMobile , shinyPredict , shinytest2 , shinyWidgets , shopifyadsR , shoppingwords , ShrinkageTrees , SIBER , SightabilityModel , sigmoid , signnet , signs , siie , simcausal , simDAG , simdata , SimDesign , SimEngine , simglm , simhelpers , simITS , SimNPH , simodels , simphony , simPIC , simpleSeg , simplifyEnrichment , SIMplyBee , simRestore , simstandard , simstudy , SimSurvey , simTool , SimTOST , simtrial , simulator , simulist , Single.mTEC.Transcriptomes , SingleCaseES , SingleCellAlleleExperiment , SingleCellMultiModal , SingleR , SIT , sitmo , sitrep , sits , sixtyfour , sjmisc , sjstats , skpr , skylight , slackr , SLGP , slim , slurm , slxr , smacof , smcfcs , smer , SMFilter , smidm , smile , smof , smoothy , smriti , snapchatadsR , snifter , SNMA , sobol , socialmixr , sociome , socviz , Sofi , SomaticCancerAlterations , sotkanet , SpaDES.core , spant , sparklyr , sparrpowR , sparseMVN , sparsesurv , SparseVFC , SpatialArtifacts , SpatialEpi , SpatialInference , spatialrisk , spatialSimGP , spbabel , spbal , spdep , SPECK , spFFBS , spheresmooth , SPIChanges , splatter , splicelogic , SplicingFactory , splikit , splineCox , SplineDV , splinetrials , splots , spmixW , spmodel , spongebob , spotr , SRscore , srvyr , sshist , ssmodels , SSN2 , SSNbler , SSOSVM , ssPATHS , sspm , staat1cho , stabm , stagsynth , staRgate , starm , stars , StateLevelForest , states , statquotes , stats19 , statsExpressions , stdbscan , stenR , stepcount , stgam , stochcorr , stors , StratifiedSampling , streamDAG , streamDepletr , stressor , struct , StructuralVariantAnnotation , SubcellularSpatialData , subincomeR , subtools , sugarbag , SunsVoc , SuperLearner , supernova , supersigs , superspreading , SuperSurv , Surrogate , surveyCV , surveyvoi , survlab , SurvMetrics , survML , svaNUMT , svaRetro , SveltePlots , svrep , swag , swaRmverse , sweep , swfdr , swipeR , symbolicr , synapsis , synaptome.db , systemfonts , T4transport , tableone , taboolaR , TabulaMurisSenisData , tabxplor , TAD , taipan , talib , TAPseq , taxdiv , tayloRswift , tbl2xts , tboot , TCGAretriever , TDbasedUFEadv , TeachingDemos , teal , teal.reporter , tealeaves , TEKRABber , terminaldigits , terralink , testassay , testDriveR , TestFunctions , texreg , textAnnotatoR , textplot , TFEA.ChIP , tfestimators , tfevents , TFutils , tglkmeans , themis , theorytools , threesixtygiving , tibble , tictactoe , tidycat , tidycensus , tidycensuskr , tidyEmoji , tidyextreme , tidyfit , tidyfst , tidygeocoder , tidyHeatmap , tidyhte , tidyhydat , tidyjson , tidylda , tidylo , TidyMultiqc , tidync , tidynorm , tidyomics , tidyprompt , tidyrhrv , tidyrstats , tidysmd , tidySummaries , tidytext , tidytransit , tidytreatment , tidyxl , tigris , tiktokadsR , tikzDevice , timeSeriesDataSets , timevarcorr , tint , tinycodet , tinysnapshot , tinytable , tinyVAST , tissueTreg , tlars , tmap , Tmisc , tongfen , toolStability , topChef , totalcensus , tourr , trace , tracerer , trackdf , transx , trapezoid , treasury , TreatmentPatterns , TreeAndLeaf , treedater , TreeDist , treeio , treespace , treestats , treestructure , TreeSummarizedExperiment , TREG , trending , trendseries , TRexSelector , TriDimRegression , tRNAscanImport , troopdata , trouBBlme4SolveR , trps , truelies , tsbox , tsfeatures , tsibble , tsibbledata , tsibbletalk , TSrepr , tuber , tuberculosis , tubern , tufterhandout , tulpaMesh , TumourMethData , tvrmst , twitteradsR , twoxtwo , UCell , uci , ukbabynames , ukgasapi , ukpolice , unicol , unitquantreg , units , unmconf , unvotes , USA.state.boundaries , usdata , usdatasets , usefun , usincometaxes , UsingR , usmap , uSORT , utile.tools , vacuum , vagalumeR , VancouvR , VARcpDetectOnline , VariantAnnotation , vcdExtra , vcfR , vdar , vdiffr , VDPO , VecDep , vectorialcalculus , velociraptor , venn , vermeulen , vetiver , VetResearchLMM , videogameinsightsR , vimp , vinereg , vioplot , vipor , viridisLite , VirtualPop , visiumStitched , visOmopResults , visreg , vitals , vivaglint , vMF , vote , vroom , vtree , warbleR , WARDEN , WaveSampling , waydown , waywiser , wbstats , wdpar , weatherOz , wefnexus , wehoop , WeightedROC , wesanderson , whep , where , whereami , whirl , whitewater , wid , widyr , wildlifeDI , wildmeta , windsoraiR , wmwAUC , WoodSimulatR , WordR , workloopR , worldbank , woylier , WpProj , WRS2 , wrswoR , wxgenR , xaringanthemer , xCell2 , xdvir , xgb2sql , xgboost , XICOR , XLConnect , xlr , xplainfi , xtvfreg , yardstick , yfR , z22 , zenplots , zinbwave , ZIprop , zoo , zoolog , ztpln , ZVCV
URL
https://ggplot2.tidyverse.org , https://github.com/tidyverse/ggplot2
Version
4.0.3
Vignettes
Extending ggplot2 ( source , R code ) Using ggplot2 in packages ( source , R code ) Aesthetic specifications ( source , R code ) Introduction to ggplot2 ( source , R code ) Profiling Performance ( source , R code )
Windows Binaries
r-devel: ggplot2_4.0.3.zip , r-release: ggplot2_4.0.3.zip , r-oldrel: ggplot2_4.0.3.zip
MacOS Binaries
r-release (arm64): ggplot2_4.0.3.tgz , r-oldrel (arm64): ggplot2_4.0.3.tgz , r-release (x86_64): ggplot2_4.0.3.tgz , r-oldrel (x86_64): ggplot2_4.0.3.tgz
Version
4.0.3
Enhances
sp
Published
2026-04-22
DOI
10.32614/CRAN.package.ggplot2
Author
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]
Maintainer
Thomas Lin Pedersen <thomas.pedersen at posit.co>
BugReports
https://github.com/tidyverse/ggplot2/issues
License
MIT + file LICENSE
URL
https://ggplot2.tidyverse.org , https://github.com/tidyverse/ggplot2
NeedsCompilation
no
Citation
ggplot2 citation info
Materials
README , NEWS
In Views
ChemPhys , NetworkAnalysis , Phylogenetics , Spatial , TeachingStatistics
CRAN Checks
ggplot2 results
Reference Manual
ggplot2.html , ggplot2.pdf
Vignettes
Extending ggplot2 ( source , R code ) Using ggplot2 in packages ( source , R code ) Aesthetic specifications ( source , R code ) Introduction to ggplot2 ( source , R code ) Profiling Performance ( source , R code )
Package Source
ggplot2_4.0.3.tar.gz
Windows Binaries
r-devel: ggplot2_4.0.3.zip , r-release: ggplot2_4.0.3.zip , r-oldrel: ggplot2_4.0.3.zip
MacOS Binaries
r-release (arm64): ggplot2_4.0.3.tgz , r-oldrel (arm64): ggplot2_4.0.3.tgz , r-release (x86_64): ggplot2_4.0.3.tgz , r-oldrel (x86_64): ggplot2_4.0.3.tgz
Old Sources
ggplot2 archive
Reverse Depends
accessrmd , afmToolkit , alakazam , alookr , AmpliconDuo , Anaconda , Anaquin , apisensr , applicable , ausplotsR , bacon , BasketballAnalyzeR , bayesDP , bayesnec , bbnet , bde , bhm , bmscstan , bootnet , bpcp , braidReports , bunching , CalibrationCurves , caret , CellNOptR , ceterisParibus , cfda , changepoint.geo , changeS , CHETAH , ChIPQC , circhelp , cjoint , ClassificationEnsembles , classifierplots , clustEff , ClusteredMutations , clustrd , CNVrd2 , CNVScope , coefplot , cogena , cohorttools , ConconiAnaerobicThresholdTest , ContourFunctions , corkscrew , CoSMoS , CRABS , CrispRVariants , crmPack , Crossover , CRTgeeDR , crumblr , CTxCC , curatedBreastData , cystiSim , cytofan , dae , DaMiRseq , dampack , dartR , dartR.base , dartR.sim , ddecompose , decompTumor2Sig , Deducer , deltaGseg , DendroSync , DepthProc , DEqMS , DHBins , diathor , diffEnrich , diffeR , DiSCos , dittoSeq , dittoViz , dnn , donutsk , dotwhisker , dowser , dpGMM , dreamlet , dslice , dynr , Eagle , echoice2 , eeptools , egg , embryogrowth , EnhancedVolcano , EnsCat , EpiCurve , episensr , EQUALCompareImages , EQUALPrognosis , EQUALrepeat , erccdashboard , escheR , eVCGsampler , extraChIPs , FactoClass , factoextra , factorplot , Factoshiny , fbroc , findGSEP , FisherEM , flippant , ForecastingEnsembles , forestmodel , FormulR , freqparcoord , frequency , func2vis , funMoDisco , gam.hp , gapmap , garma , GARS , gcerisk , gde , GenericML , genlogis , GenomicOZone , geomtextpath , geotoolsR , GerminaR , gg4way , ggalign , ggallin , ggalluvial , GGally , gganimate , ggarrow , ggbeeswarm , ggbio , ggbiplot , ggbuildr , ggcharts , ggcorrplot , ggcyto , ggdemetra , ggdensity , ggetho , ggExametrika , ggFishPlots , ggfixest , ggfocus , ggforce , ggformula , ggfortify , ggfoundry , gggda , gggenomes , ggghost , gggibbous , gggrid , ggh4x , gghighlight , ggHoriPlot , ggimage , ggincerta , gginnards , ggInterval , ggip , ggkegg , gglm , gglorenz , ggmanh , ggmap , ggmapcn , ggmatplot , ggmcmc
Reverse Imports
a11yShiny , ABACUS , abe , ABHgenotypeR , abseqR , AbSolution , absorber , abstractr , AcademicThemes , acc , acca , AccelStab , AcceptReject , accrualPlot , accSDA , ACDm , ACE , achieveGap , actel , activAnalyzer , ActivePathways , activPAL , actogrammr , actuaRE , actuary , actxps , ADAMgui , adaplots , ADAPT , adaptiveGPCA , adas.utils , add2ggplot , adegenet , adestr , AdIsMF , adjclust , adjROC , adnuts , adobeanalyticsr , adplots , adproclus , adrftools , AdsorpR , adsoRptionCMF , adventr , AdverseEvents , aeddo , aedseo , aelab , Aerith , AeRobiology , AeroSampleR , afcharts , AFFECT , affinitymatrix , affycoretools , AFR , afttest , agcounts , AgeBandDecomposition , AgePopDenom , AgeTopicModels , agfh , aggreCAT , agregR , agricolaeplotr , AgriDiversiX , agriReg , agriTutorial , agriutilities , agrobox , AgroR , AgroReg , agrostab , AgroTech , agua , ahnr , AHPGaussian , AHPWR , AIBias , AID , AIDA , aihuman , aimPlot , AIPW , airpart , airship , airt , akc , albersdown , aLBI , ale , alevinQC , alien , allestimates , allMT , AlphaBeta , alphahull , AlphaMissenseR , AlphaPart , AlpsNMR , AMARETTO , aMNLFA , amp , AMPLE , amplican , anabel , Analitica , analyzer , AnanseSeurat , anansi , Anaquin , aNCA , AnglerCreelSurveySimulation , animalcules , AnimalSequences , animbook , anipaths , aniSNA , ANN2 , AnnoProbe , annotatr , ANOFA , anomalize , anomaly , ANOPA , ANOVAIREVA , AntClassify , antedep , AntsNet , AnVILBilling , aoristic , APackOfTheClones , APAlyzer , APCI , APCtools , apexcharter , APIS , APL , aplot , aplotExtra , apm , APRScenario , APTIcalc , apyramid , AQEval , AquaticLifeHistory , aramappings , ARCensReg , archeofrag.gui , archeoViz , archipelago , archiveRetriever , ARCokrig , arcpullr , ARDL , ardlverse , arete , arima2 , artma , artMS , aRtsy , arulesViz , ArvindSt , ASICS , aslib , asmbPLS , ASML , aspline , asremlPlus , ASRgenomics , assertHE , ASSIGN , assignPOP , asuri , atacInferCnv , ATACseqTFEA , ATE.ERROR , Athlytics , ATQ , atRi
Reverse Suggests
abctools , abd , abn , aboveR , accessibility , acledR , activatr , activityCounts , AdaptGauss , adaptr , adelie , adept , adformR , adjoin , adjustedCurves , admixr , adoptr , adw , AeroEvapR , afcolours , afdx , afex , affiner , aggregateBioVar , agridat , ags , aifeducation , aire.zmvm , airGR , aisdk , ALDEx2 , aldvmm , alfred , algebraic.mle , AlgeriAPIs , AlleleShift , alone , amadeus , AMAPVox , amazonadsR , amazons3R , amazonspR , ambiorix , ambiR , ambit , ameras , AMISforInfectiousDiseases , amp.dm , amp.sim , AmpGram , AMR , amt , animint2 , ankiR , anscombiser , antaresViz , AntibodyForests , antitrust , ao , aopdata , aorsf , apa7 , api2lm , appeears , appleadsR , appsflyeR , apsimx , AquaBEHER , arcgeocoder , archetypes , archivist , arctools , arf , ArgentinAPI , aricode , aridagri , ARPobservation , arthistory , ARTool , artpack , ARUtools , ascotraceR , ashapesampler , ashr , assemblykor , AssociationExplorer2 , ASURAT , asymptor , ATbounds , atime , atrrr , aum , autothresholdr , av , avesperu , avilistr , avocado , awinR , awst , babette , bacondecomp , bage , bagyo , bakeoff , bambu , banditpam , bang , bangladesh , Banksy , baRulho , BAS , baselinenowcast , basemaps , BaseSet , basksim , baskwrap , BatchGetSymbols , Battlefield , BayesBrainMap , BayesDecon , BayesDissolution , BayesianDisaggregation , bayesianOU , bayesplay , bayespmtools , bayesPO , BayesPPD , bayesRecon , bayesSSM , bayestestR , bayesTFR , bbk , bbmle , bbssr , bcdata , bcf , bcmaps , bcp , bdlnm , beer , belg , BEMPdata , bench , benchmarkme , benthos , bertopicr , bestNormalize , BetaBit , BGmisc , bgms , bib2df , bidask , BiDimRegression , bidser , BigDataStatMeth , bigPCAcpp , bigPLSR , BIGr , bingadsR , binom , binsegRcpp , bioassayR , biobroom , BiocBuildReporter , BiocHail , BioCor , biogas , biogram , Bioi , bioLeak , BioMonTools , BioMoR , BioQC , biostat3 , BioTIP , BioWorldR , biplotEZ , BiplotML , BIS , bistablehistory , bitmexr , bivarhr , blackmarbler , BlandAlt
Reverse Enhances
cmocean , jamba , LOLA , parttree , surveillance , tind , tis
Page sections 4
Documentation
Heading
Documentation
Links
[{"label":"ggplot2.html","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/refman/ggplot2.html"},{"label":"ggplot2.pdf","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/ggplot2.pdf"},{"label":"Extending ggplot2","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/extending-ggplot2.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/extending-ggplot2.qmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/extending-ggplot2.R"},{"label":"Using ggplot2 in packages","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-in-packages.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-in-packages.qmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-in-packages.R"},{"label":"Aesthetic specifications","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-specs.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-specs.qmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-specs.R"},{"label":"Introduction to ggplot2","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2.qmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2.R"},{"label":"Profiling Performance","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/profiling.html"},{"label":"source","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/profiling.qmd"},{"label":"R code","section":"","type":"","url":"https://cran.r-project.org/web/packages/ggplot2/vignettes/profiling.R"}]
Text
Reference manual: ggplot2.html , ggplot2.pdf Vignettes: Extending ggplot2 ( source , R code ) Using ggplot2 in packages ( source , R code ) Aesthetic specifications ( source , R code ) Introduction to ggplot2 ( source , R code ) Profiling Performance ( source , R code )
Downloads
Heading
Downloads
Links
[{"label":"ggplot2_4.0.3.tar.gz","section":"","type":"","url":"https://cran.r-project.org/src/contrib/ggplot2_4.0.3.tar.gz"},{"label":"ggplot2_4.0.3.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.7/ggplot2_4.0.3.zip"},{"label":"ggplot2_4.0.3.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.6/ggplot2_4.0.3.zip"},{"label":"ggplot2_4.0.3.zip","section":"","type":"","url":"https://cran.r-project.org/bin/windows/contrib/4.5/ggplot2_4.0.3.zip"},{"label":"ggplot2_4.0.3.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/sonoma-arm64/contrib/4.6/ggplot2_4.0.3.tgz"},{"label":"ggplot2_4.0.3.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-arm64/contrib/4.5/ggplot2_4.0.3.tgz"},{"label":"ggplot2_4.0.3.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-x86_64/contrib/4.6/ggplot2_4.0.3.tgz"},{"label":"ggplot2_4.0.3.tgz","section":"","type":"","url":"https://cran.r-project.org/bin/macosx/big-sur-x86_64/contrib/4.5/ggplot2_4.0.3.tgz"},{"label":"ggplot2 archive","section":"","type":"","url":"https://CRAN.R-project.org/src/contrib/Archive/ggplot2"}]
Text
Package source: ggplot2_4.0.3.tar.gz Windows binaries: r-devel: ggplot2_4.0.3.zip , r-release: ggplot2_4.0.3.zip , r-oldrel: ggplot2_4.0.3.zip macOS binaries: r-release (arm64): ggplot2_4.0.3.tgz , r-oldrel (arm64): ggplot2_4.0.3.tgz , r-release (x86_64): ggplot2_4.0.3.tgz , r-oldrel (x86_64): ggplot2_4.0.3.tgz Old sources: ggplot2 archive
Reverse dependencies
Heading
Reverse dependencies
Links
[{"label":"accessrmd","section":"","type":"","url":"https://cran.r-project.org/web/packages/accessrmd/index.html"},{"label":"afmToolkit","section":"","type":"","url":"https://cran.r-project.org/web/packages/afmToolkit/index.html"},{"label":"alakazam","section":"","type":"","url":"https://cran.r-project.org/web/packages/alakazam/index.html"},{"label":"alookr","section":"","type":"","url":"https://cran.r-project.org/web/packages/alookr/index.html"},{"label":"AmpliconDuo","section":"","type":"","url":"https://cran.r-project.org/web/packages/AmpliconDuo/index.html"},{"label":"Anaconda","section":"","type":"","url":"https://cran.r-project.org/web/packages/Anaconda/index.html"},{"label":"Anaquin","section":"","type":"","url":"https://www.bioconductor.org/packages/release/bioc/html/Anaquin.html"},{"label":"apisensr","section":"","type":"","url":"https://cran.r-project.org/web/packages/apisensr/index.html"},{"label":"applicable","section":"","type":"","url":"https://cran.r-project.org/web/packages/applicable/index.html"},{"label":"ausplotsR","section":"","type":"","url":"https://cran.r-project.org/web/packages/ausplotsR/index.html"},{"label":"bacon","section":"","type":"","url":"https://www.bioconductor.org/packages/release/bioc/html/bacon.html"},{"label":"BasketballAnalyzeR","section":"","type":"","url":"https://cran.r-project.org/web/packages/BasketballAnalyzeR/index.html"},{"label":"bayesDP","section":"","type":"","url":"https://cran.r-project.org/web/packages/bayesDP/index.html"},{"label":"bayesnec","section":"","type":"","url":"https://cran.r-project.org/web/packages/bayesnec/index.html"},{"label":"bbnet","section":"","type":"","url":"https://cran.r-project.org/web/packages/bbnet/index.html"},{"label":"bde","section":"","type":"","url":"https://cran.r-project.org/web/packages/bde/index.html"},{"label":"bhm","section":"","type":"","url":"https://cran.r-project.org/web/packages/bhm/index.html"},{"label":"bmscstan","section":"","type":"","url":"https://cran.r-project.org/web/packages/bmscstan/index.html"},{"label":"bootnet","section":"","type":"","url":"https://cran.r-project.org/web/packages/bootnet/index.html"},{"label":"bpcp","section":"","type":"","url":"https://cran.r-project.org/web/packages/bpcp/index.html"}]
Text
Reverse depends: accessrmd , afmToolkit , alakazam , alookr , AmpliconDuo , Anaconda , Anaquin , apisensr , applicable , ausplotsR , bacon , BasketballAnalyzeR , bayesDP , bayesnec , bbnet , bde , bhm , bmscstan , bootnet , bpcp , braidReports , bunching , CalibrationCurves , caret , CellNOptR , ceterisParibus , cfda , changepoint.geo , changeS , CHETAH , ChIPQC , circhelp , cjoint , ClassificationEnsembles , classifierplots , clustEff , ClusteredMutations , clustrd , CNVrd2 , CNVScope , coefplot , cogena , cohorttools , ConconiAnaerobicThresholdTest , ContourFunctions , corkscrew , CoSMoS , CRABS , CrispRVariants , crmPack , Crossover , CRTgeeDR , crumblr , CTxCC , curatedBreastData , cystiSim , cytofan , dae , DaMiRseq , dampack , dartR , dartR.base , dartR.sim , ddecompose , decompTumor2Sig , Deducer , deltaGseg , DendroSync , DepthProc , DEqMS , DHBins , diathor , diffEnrich , diffeR , DiSCos , dittoSeq , dittoViz , dnn , donutsk , dotwhisker , dowser , dpGMM , dreamlet , dslice , dynr , Eagle , echoice2 , eeptools , egg , embryogrowth , EnhancedVolcano , EnsCat , EpiCurve , episensr , EQUALCompareImages , EQUALPrognosis , EQUALrepeat , erccdashboard , escheR , eVCGsampler , extraChIPs , FactoClass , factoextra , factorplot , Factoshiny , fbroc , findGSEP , FisherEM , flippant , ForecastingEnsembles , forestmodel , FormulR , freqparcoord , frequency , func2vis , funMoDisco , gam.hp , gapmap , garma , GARS , gcerisk , gde , GenericML , genlogis , GenomicOZone , geomtextpath , geotoolsR , GerminaR , gg4way , ggalign , ggallin , ggalluvial , GGally , gganimate , ggarrow , ggbeeswarm , ggbio , ggbiplot , ggbuildr , ggcharts , ggcorrplot , ggcyto , ggdemetra , ggdensity , ggetho , ggExametrika , ggFishPlots , ggfixest , ggfocus , ggforce , ggformula , ggfortify , ggfoundry , gggda , gggenomes , ggghost , gggibbous , gggrid , ggh4x , gghighlight , ggHoriPlot , ggimage , ggincerta , gginnards , ggInterval , ggip , ggkegg , gglm , gglorenz , ggmanh , ggmap , ggmapcn , g
Linking
Heading
Linking
Links
[{"label":"https://CRAN.R-project.org/package=ggplot2","section":"","type":"","url":"https://CRAN.R-project.org/package=ggplot2"}]
Text
Please use the canonical form https://CRAN.R-project.org/package=ggplot2 to link to this page.
Materials 2
Documentation 17
Vignettes 15
Downloads 9
All page links 120

패키지 문서 원문

8 artifacts
citation
Citation
CRAN · 4.0.3 · Citation · text/html · 947 · 2026-05-07
Title
CRAN: ggplot2 citation info
Label
Citation
Text content
Text content
CRAN: ggplot2 citation info To cite ggplot2 in publications, please use Wickham H (2016). ggplot2: Elegant Graphics for Data Analysis . Springer-Verlag New York. ISBN 978-3-319-24277-4, https://ggplot2.tidyverse.org . Corresponding BibTeX entry: @Book{, author = {Hadley Wickham}, title = {ggplot2: Elegant Graphics for Data Analysis}, publisher = {Springer-Verlag New York}, year = {2016}, isbn = {978-3-319-24277-4}, url = {https://ggplot2.tidyverse.org}, }
field
NEWS
CRAN · 4.0.3 · Materials · text/html · 221,922 · 2026-05-07
Title
NEWS
Label
NEWS
Text content
Text content
NEWS code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } div.sourceCode { margin: 1em 0; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ ggplot2 4.0.3 This is a hotfix release fixing a test, a bug and introducing a feature. Adapt to changes in rlang::warn_dots_used() ( @lionel -, #6830). Fixed bug where guide_axis_theta() didn’t anticipate old-style text elements (#6803). geom_boxplot() / stat_boxplot() gain a quantile.type parameter (default 7 ) to control the percentile definition used for hinges and median; set quantile.type = 2 to match SAS’s default PCTLDEF = 5 , enabling parity with SAS boxplots out-of-the-box. ( @munoztd0 , #6819) ggplot2 4.0.2 This hotfix release makes ggplot2 more interoperable between rlang versions. make_constructor() no longer captures rlang::list2() at build time. ggplot2 4.0.1 This is a smaller patch release focussed on fixing regressions from 4.0.0 and polishing the recent features. Bug fixes Fixed regression where geom_area() didn’t draw panels with single groups when stat = "align" ( @teunbrand , #6680) Fixed regression where position_stack(vjust) was ignored when there are only single groups (#6692) Fixed bug where NA handling in geom_path() was ignoring panels ( @teunbrand , #6533) Fixed bug where stat_bin(boundary) was ignored (#6682). geom_text() and geom_label() accept expressions as the label aesthetic ( @teunbrand , #6638) Fixed regression where draw_key_rect() stopped using fill colours ( @mitchelloharawild , #6609). Fixed regression where scale_{x,y}_*() threw an error when an expression object is set to labels argument ( @yutannihilation , #6617). Fixed regression where the first (unnamed) argument to colour/fill scales was not passed as the name argument ( @teunbrand , #6623) Fixed issue where vectorised arrow() s caused errors in drawing the legend glyphs ( @teunbrand , #6594) Fixed regression where NULL -aesthetics contributed to plot labels too insistently. Now they contribute only as fallback labels ( @teunbrand , #6616) Fixed regression where empty arguments to colour/fill scale caused errors ( @jmbarbone , #6710) Fixed axis misplacement in coor_radial() when labels are blank ( @teunbrand , #6574) Improvements Improved palette fallback mechanism in scales ( @teunbrand , #6669). Allow stat in geom_hline , geom_vline , and geom_abline . ( @sierrajohnson , #6559) stat_boxplot() treats width as an optional aesthetic ( @Yunuuuu , #6575) The theme(panel.widths, panel.heights) setting attempts to preserve the plot’s aspect ratio when only one of the two settings is given, and the plot has a single panel ( @teunbrand , #6701). Logical values for the linetype aesthetic will be interpreted numerically, so that linetype = FALSE becomes 0/‘blank’ and linetype = TRUE becomes 1/‘solid’ ( @teunbrand , #6641) Out-of-bounds datapoints used as padding by stat_align() now get removed silently rather than verbosely ( @teunbrand , #6667) ggplot2 4.0.0 User facing Breaking changes The S3 parts of ggplot2 have been replaced with S7 bits (#6352). (breaking) geom_violin(quantiles) now has actual quantiles based on the data, rather than inferred quantiles based on the computed density. The quantiles parameter that replaces draw_quantiles now belongs to stat_ydensity() instead of geom_violin() ( @teunbrand , #4120). (Breaking) The defaults for all geoms can be set at one in the theme. ( @teunbrand based on pioneering work by @dpseidel , #2239) A new theme(geom) argument is used to track these defaults. The element_geom() function can be used to populate that argument. The from_theme() function allows access to the theme default fields from inside the aes() function. Moved the following packages in the description. If your package depended on ggplot2 to install these dependencies, you may need to list these in your own DESCRIPTION file now (#5986). Moved mgcv from Imports to Suggests Moved tibble from Imports to Suggests Removed glue dependency Default labels are derived in build_ggplot() (previously ggplot_build() ) rather than in the layer method of update_ggplot() (previously ggplot_add.Layer() ). This may affect code that accessed the plot$labels property ( @teunbrand , #5894). In binning stats, the default boundary is now chosen to better adhere to the nbin argument. This may affect plots that use default binning ( @teunbrand , #5882, #5036) Lifecycle changes Deprecated functions and arguments prior to ggplot2 3.0.0 throw errors instead of warnings. Functions and arguments that were soft-deprecated up to ggplot2 3.4.0 now throw warnings. annotation_borders() replaces the now-deprecated borders() ( @teunbrand , #6392) Turned off fallback for size to linewidth translation in geom_bar() / geom_col() (#4848). The fatten argument has been deprecated in geom_boxplot() , geom_crossbar() and geom_pointrange() ( @teunbrand , #4881). The following me
field
README
CRAN · 4.0.3 · Materials · text/html · 11,528 · 2026-05-07
Title
README
Label
README
Text content
Text content
README code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } div.sourceCode { margin: 1em 0; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { color: #008000; } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { color: #008000; font-weight: bold; } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ ggplot2 Overview ggplot2 is 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. Installation # The easiest way to get ggplot2 is to install the whole tidyverse: install.packages ( "tidyverse" ) # Alternatively, install just ggplot2: install.packages ( "ggplot2" ) # Or the development version from GitHub: # install.packages("pak") pak :: pak ( "tidyverse/ggplot2" ) Cheatsheet Usage It’s hard to succinctly describe how ggplot2 works because it embodies a deep philosophy of visualisation. However, in most cases you start with ggplot() , supply a dataset and aesthetic mapping (with aes() ). You then add on layers (like geom_point() or geom_histogram() ), scales (like scale_colour_brewer() ), faceting specifications (like facet_wrap() ) and coordinate systems (like coord_flip() ). library (ggplot2) ggplot (mpg, aes (displ, hwy, colour = class)) + geom_point () Lifecycle ggplot2 is now over 10 years old and is used by hundreds of thousands of people to make millions of plots. That means, by-and-large, ggplot2 itself changes relatively little. When we do make changes, they will be generally to add new functions or arguments rather than changing the behaviour of existing functions, and if we do make changes to existing behaviour we will do them for compelling reasons. If you are looking for innovation, look to ggplot2’s rich ecosystem of extensions. See a community maintained list at https://exts.ggplot2.tidyverse.org/gallery/ . Learning ggplot2 If you are new to ggplot2 you are better off starting with a systematic introduction, rather than trying to learn from reading individual documentation pages. Currently, there are several good places to start: The Data Visualization and Communication chapters in R for Data Science . R for Data Science is designed to give you a comprehensive introduction to the tidyverse , and these two chapters will get you up to speed with the essentials of ggplot2 as quickly as possible. If you’d like to take an online course, try Data Visualization in R With ggplot2 by Kara Woo. If you’d like to follow a webinar, try Plotting Anything with ggplot2 by Thomas Lin Pedersen. If you want to dive into making common graphics as quickly as possible, I recommend The R Graphics Cookbook by Winston Chang. It provides a set of recipes to solve common graphics problems. If you’ve mastered the basics and want to learn more, read ggplot2: Elegant Graphics for Data Analysis . It describes the theoretical underpinnings of ggplot2 and shows you how all the pieces fit together. This book helps you understand the theory that underpins ggplot2, and will help you create new types of graphics specifically tailored to your needs. For articles about announcements and deep-dives you can visit the tidyverse blog . Getting help There are two main places to get help with ggplot2: The Posit Community (formerly RStudio Community) is a friendly place to ask any questions about ggplot2. Stack Overflow is a great source of answers to common ggplot2 questions. It is also a great place to get help, once you have created a reproducible example that illustrates your problem.
reference_manual_html
Reference manual HTML
CRAN · 4.0.3 · Documentation · text/html · 1,384,049 · 2026-05-07
Title
Help for package ggplot2
Label
Reference manual HTML
Text content
Text content
Help for package ggplot2 const macros = { "\\R": "\\textsf{R}", "\\mbox": "\\text", "\\code": "\\texttt"}; function processMathHTML() { var l = document.getElementsByClassName('reqn'); for (let e of l) { katex.render(e.textContent, e, { throwOnError: false, macros }); } return; } Package {ggplot2} Contents ggplot2-package Coord CoordSf Facet Geom Guide Layer-class Layout Position Scale Stat absoluteGrob add_gg add_theme aes aes_ aes_all aes_auto aes_colour_fill_alpha aes_eval aes_group_order aes_linetype_size_shape aes_position annotate annotation_borders annotation_custom annotation_logticks annotation_map annotation_raster as.list.ggproto as_labeller autolayer automatic_plotting autoplot benchplot bidirection binned_scale calc_element check_device class_definitions class_ggplot class_ggplot_built class_labels class_mapping class_theme combine_vars complete_theme continuous_scale coord_cartesian coord_fixed coord_flip coord_map coord_munch coord_polar coord_transform cut_interval datetime_scale diamonds discrete_scale draw_key economics element_grob element_render expand_limits expansion facet_grid facet_null facet_wrap faithfuld fill_alpha find_panel fortify fortify-multcomp fortify.lm fortify.map fortify.sp geom_abline geom_bar geom_bin_2d geom_blank geom_boxplot geom_contour geom_count geom_crossbar geom_density geom_density_2d geom_dotplot geom_freqpoly geom_function geom_hex geom_jitter geom_label geom_map geom_path geom_point geom_polygon geom_qq_line geom_quantile geom_raster geom_ribbon geom_rug geom_segment geom_smooth geom_spoke geom_violin get_alt_text get_geom_defaults get_guide_data get_last_plot get_strip_labels get_theme gg_dep gg_par ggplot ggplot2-ggproto ggplotGrob ggplot_build ggplot_gtable ggproto ggsave ggtheme graphical-units guide_axis guide_axis_logticks guide_axis_stack guide_axis_theta guide_bins guide_colourbar guide_coloursteps guide_custom guide_legend guide_none guides hmisc ignoring_data is_ggproto is_rel label_bquote labeller labellers labs layer layer_geoms layer_positions layer_sf layer_stats limits lims luv_colours make_constructor map_data margin max_height mean_se merge_element midwest mpg msleep new_guide old_guide pattern_alpha position_dodge position_identity position_jitter position_jitterdodge position_nudge position_stack presidential print.ggplot print.ggproto qplot reexports register_theme_elements remove_missing render_axes render_strips resolution scale_alpha scale_binned scale_colour_brewer scale_colour_continuous scale_colour_discrete scale_colour_gradient scale_colour_grey scale_colour_hue scale_colour_steps scale_colour_viridis_d scale_continuous scale_date scale_identity scale_linetype scale_linewidth scale_manual scale_shape scale_size scale_type scale_x_discrete seals sec_axis set_last_plot sf_transform_xy should_stop standardise_aes_names stat_connect stat_ecdf stat_ellipse stat_identity stat_manual stat_sf_coordinates stat_summary_2d stat_summary_bin stat_unique subtheme summarise_plot theme tidyeval transform_position translate_shape_string txhousing update_geom_defaults update_ggplot update_labels vars waiver wrap_dims zeroGrob Title: Create Elegant Data Visualisations Using the Grammar of Graphics Version: 4.0.3 Description: 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. License: MIT + file LICENSE URL: https://ggplot2.tidyverse.org , https://github.com/tidyverse/ggplot2 BugReports: https://github.com/tidyverse/ggplot2/issues Depends: R (≥ 4.1) Imports: cli, grDevices, grid, gtable (≥ 0.3.6), isoband, lifecycle (> 1.0.1), rlang (≥ 1.1.0), S7, scales (≥ 1.4.0), stats, vctrs (≥ 0.6.0), withr (≥ 2.5.0) Suggests: broom, covr, dplyr, ggplot2movies, hexbin, Hmisc, hms, knitr, mapproj, maps, MASS, mgcv, multcomp, munsell, nlme, profvis, quantreg, quarto, ragg (≥ 1.2.6), RColorBrewer, roxygen2, rpart, sf (≥ 0.7-3), svglite (≥ 2.1.2), testthat (≥ 3.1.5), tibble, vdiffr (≥ 1.0.6), xml2 Enhances: sp VignetteBuilder: quarto Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate Config/testthat/edition: 3 Config/usethis/last-upkeep: 2025-04-23 Encoding: UTF-8 LazyData: true RoxygenNote: 7.3.3 Collate: 'ggproto.R' 'ggplot-global.R' 'aaa-.R' 'aes-colour-fill-alpha.R' 'aes-evaluation.R' 'aes-group-order.R' 'aes-linetype-size-shape.R' 'aes-position.R' 'all-classes.R' 'compat-plyr.R' 'utilities.R' 'aes.R' 'annotation-borders.R' 'utilities-checks.R' 'legend-draw.R' 'geom-.R' 'annotation-custom.R' 'annotation-logticks.R' 'scale-type.R' 'layer.R' 'make-constructor.R' 'geom-polygon.R' 'geom-map.R' 'annotation-map.R' 'geom-raster.R' 'annotation-raster.R' 'annotation.R' 'autolayer.R' 'autoplot.R' 'axis-secondary.R' 'backports.R' 'bench.R' 'bin.R' 'coord-.R' 'coord-cartesian-.R' 'coord-fixed.R' 'coord-flip.R' 'coord-map.R' 'coord-munch.R' 'coord-polar.R' 'coord-quickmap.R' 'coord-radial.R' 'coord-sf.R' 'coord-transform.R' 'data.R' 'docs_layer.R' 'facet-.R' 'facet-grid-.R' 'facet-null.R' 'facet-wrap.R' 'fortify-map.R' 'fortify-models.R' 'fortify-spatial.R' 'fortify.R' 'stat-.R' 'geom-abline.R' 'geom-rect.R' 'geom-bar.R' 'geom-tile.R' 'geom-bin2d.R' 'geom-blank.R' 'geom-boxplot.R' 'geom-col.R' 'geom-path.R' 'geom-contour.R' 'geom-point.R' 'geom-count.R' 'geom-crossbar.R' 'geom-segment.R' 'geom-curve.R' 'geom-defaults.R' 'geom-ribbon.R' 'geom-density.R' 'geom-density2d.R' 'geom-dotplot.R' 'geom-errorbar.R' 'geom-freqpoly.R' 'geom-function.R' 'geom-hex.R' 'geom-histogram.R' 'geom-hline.R' 'geom-jitter.R' 'geom-label.R' 'geom-linerange.R' 'geom-pointrange.R' 'geom-quantile.R' 'geom-rug.R' 'geom-sf.R' 'geom-smooth.R' 'geom-spoke.R' 'geom-text.R' 'geom-violin.R' 'geom-vline.R' 'ggplot2-package.R' 'grob-absolute.R' 'grob-dotstack.R' 'grob-null.R' 'grouping.R' 'properties.R' 'margins.R' 'theme-elements.R' 'guide-.R' 'guide-axis.R' 'guide-axis-logticks.R' 'guide-axis-stack.R' 'guide-axis-theta.R' 'guide-legend.R' 'guide-bins.R' 'guide-colorbar.R' 'guide-colorsteps.R' 'guide-custom.R' 'guide-none.R' 'guide-old.R' 'guides-.R' 'guides-grid.R' 'hexbin.R' 'import-standalone-obj-type.R' 'import-standalone-types-check.R' 'labeller.R' 'labels.R' 'layer-sf.R' 'layout.R' 'limits.R' 'performance.R' 'plot-build.R' 'plot-construction.R' 'plot-last.R' 'plot.R' 'position-.R' 'position-collide.R' 'position-dodge.R' 'position-dodge2.R' 'position-identity.R' 'position-jitter.R' 'position-jitterdodge.R' 'position-nudge.R' 'position-stack.R' 'quick-plot.R' 'reshape-add-margins.R' 'save.R' 'scale-.R' 'scale-alpha.R' 'scale-binned.R' 'scale-brewer.R' 'scale-colour.R' 'scale-continuous.R' 'scale-date.R' 'scale-discrete-.R' 'scale-expansion.R' 'scale-gradient.R' 'scale-grey.R' 'scale-hue.R' 'scale-identity.R' 'scale-linetype.R' 'scale-linewidth.R' 'scale-manual.R' 'scale-shape.R' 'scale-size.R' 'scale-steps.R' 'scale-view.R' 'scale-viridis.R' 'scales-.R' 'stat-align.R' 'stat-bin.R' 'stat-summary-2d.R' 'stat-bin2d.R' 'stat-bindot.R' 'stat-binhex.R' 'stat-boxplot.R' 'stat-connect.R' 'stat-contour.R' 'stat-count.R' 'stat-density-2d.R' 'stat-density.R' 'stat-ecdf.R' 'stat-ellipse.R' 'stat-function.R' 'stat-identity.R' 'stat-manual.R' 'stat-qq-line.R' 'stat-qq.R' 'stat-quantilemethods.R' 'stat-sf-coordinates.R' 'stat-sf.R' 'stat-smooth-methods.R' 'stat-smooth.R' 'stat-sum.R' 'stat-summary-bin.R' 'stat-summary-hex.R' 'stat-summary.R' 'stat-unique.R' 'stat-ydensity.R' 'summarise-plot.R' 'summary.R' 'theme.R' 'theme-defaults.R' 'theme-current.R' 'theme-sub.R' 'utilities-break.R' 'utilities-grid.R' 'utilities-help.R' 'utilities-patterns.R' 'utilities-resolution.R' 'utilities-tidy-eval.R' 'zxx.R' 'zzz.R' NeedsCompilation: no Packaged: 2026-04-21 12:47:29 UTC; thomas Author: 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],
section
ggplot2.pdf
CRAN · 4.0.3 · Documentation · application/pdf · 1,076,533 · 2026-05-07
Title
ggplot2.pdf
Label
ggplot2.pdf
field
Add components to a plot
R-universe · 4.0.3.9000 · Add components to a plot · text/html; charset=utf-8 · 2,196,703 · 2026-05-07
Title
Package 'ggplot2' reference manual
Label
Add components to a plot
Text content
Text content
Package 'ggplot2' reference manual Package 'ggplot2' Title: Create Elegant Data Visualisations Using the Grammar of Graphics Description: 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] (ORCID: <https://orcid.org/0000-0003-4757-117X>), Winston Chang [aut] (ORCID: <https://orcid.org/0000-0002-1576-2126>), Lionel Henry [aut], Thomas Lin Pedersen [aut, cre] (ORCID: <https://orcid.org/0000-0002-5147-4711>), Kohske Takahashi [aut], Claus Wilke [aut] (ORCID: <https://orcid.org/0000-0002-7470-9261>), Kara Woo [aut] (ORCID: <https://orcid.org/0000-0002-5125-4188>), Hiroaki Yutani [aut] (ORCID: <https://orcid.org/0000-0002-3385-7233>), Dewey Dunnington [aut] (ORCID: <https://orcid.org/0000-0002-9415-4582>), Teun van den Brand [aut] (ORCID: <https://orcid.org/0000-0002-9335-7468>), Posit, PBC [cph, fnd] (ROR: <https://ror.org/03wc8by49>) Maintainer: Thomas Lin Pedersen < [email protected] > License: MIT + file LICENSE Version: 4.0.3.9000 Built: 2026-04-25 13:56:20 UTC Source: https://github.com/tidyverse/ggplot2 Help Index Add components to a plot Construct aesthetic mappings Colour related aesthetics: colour, fill, and alpha Control aesthetic evaluation Aesthetics: grouping Differentiation related aesthetics: linetype, size, shape Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend Create an annotation layer Create a layer of map borders Annotation: Custom grob Annotation: log tick marks Annotation: a map Annotation: high-performance rectangular tiling Create a ggplot layer appropriate to a particular data type Tailoring plots to particular data types Create a complete ggplot appropriate to a particular data type Cartesian coordinates Cartesian coordinates with fixed "aspect ratio" Cartesian coordinates with x and y flipped Map projections Polar coordinates Transformed Cartesian coordinate system Visualise sf objects Discretise numeric data into categorical Prices of over 50,000 round cut diamonds Key glyphs for legends US economic time series Expand the plot limits, using data Generate expansion vector for scales Lay out panels in a grid Wrap a 1d ribbon of panels into 2d 2d density estimate of Old Faithful data Fortify a model with data. Reference lines: horizontal, vertical, and diagonal Bar charts Heatmap of 2d bin counts Draw nothing A box and whiskers plot (in the style of Tukey) 2D contours of a 3D surface Count overlapping points Vertical intervals: lines, crossbars & errorbars Smoothed density estimates Contours of a 2D density estimate Dot plot Histograms and frequency polygons Draw a function as a continuous curve Hexagonal heatmap of 2d bin counts Jittered points Text Polygons from a reference map Connect observations Points Polygons A quantile-quantile plot Quantile regression Rectangles Ribbons and area plots Rug plots in the margins Line segments and curves Smoothed conditional means Line segments parameterised by location, direction and distance Violin plot Extract alt text from a plot Get, set, and modify the active theme Create a new ggplot Create a new ggproto object Save a ggplot (or other grid object) with sensible defaults Complete themes Axis guide Axis with logarithmic tick marks Stacked axis guides Angle axis guide A binned version of guide_legend Continuous colour bar guide Discretized colourbar guide Custom guides Legend guide Empty guide Set guides for each scale A selection of summary functions from Hmisc Label with mathematical expressions Construct labelling specification Useful labeller functions Modify axis, legend, and plot labels Layer geometry display Layer position adjustments Layer statistical transformations Set scale limits colors() in Luv space Theme elements Calculate mean and standard error of the mean Midwest demographics Fuel economy data from 1999 to 2008 for 38 popular models of cars An updated and expanded version of the mammals sleep dataset Dodge overlapping objects side-to-side Don't adjust position Jitter points to avoid overplotting Simultaneously dodge and jitter Nudge points a fixed distance Stack overlapping objects on top of each another Terms of 12 presidents from Eisenhower to Trump Explicitly draw plot Format or print a ggproto object Quick plot Compute the "resolution" of a numeric vector Alpha transparency scales Positional scales for binning continuous data (x & y) Sequential, diverging and qualitative colour scales from ColorBrewer Continuous and binned colour scales Discrete colour scales Gradient colour scales Sequential grey colour scales Evenly spaced colours for discrete data Binned gradient colour scales Viridis colour scales from viridisLite Position scales for continuous data (x & y) Position scales for date/time data Use values without scaling Scale for line patterns Scales for line width Create your own discrete scale Scales for shapes, aka glyphs Scales for area or radius Position scales for discrete data Vector field of seal movements Specify a secondary axis Connect observations Compute empirical cumulative distribution Compute normal data ellipses Leave data as is Manually compute transformations Extract coordinates from 'sf' objects Bin and summarise in 2d (rectangle & hexagons) Summarise y values at unique/binned x Remove duplicates Shortcuts for theme settings Modify components of a theme Housing sales in TX Quote faceting variables Add components to a plot Description + is the key to constructing sophisticated ggplot2 graphics. It allows you to start simple, then get more and more complex, checking your work at each step. Usage add_gg(e1, e2) e1 %+% e2 add_gg ( e1 , e2 ) e1 %+% e2 Arguments e1 An object of class ggplot() or a theme() . e2 A plot component, as described below. What can you add? You can add any of the following types of objects: An aes() object replaces the default aesthetics. A layer created by a geom_ or stat_ function adds a new layer. A scale overrides the existing scale. A theme() modifies the current theme. A coord overrides the current coordinate system. A facet specification overrides the current faceting. To replace the current default data frame, you must use ⁠%+%⁠ , due to S3 method precedence issues. You can also supply a list, in which case each element of the list will be added in turn. See Also theme() Examples base <- ggplot(mpg, aes(displ, hwy)) + geom_point() base + geom_smooth() # To override the data, you must use %+% base %+% subset(mpg, fl == "p") # Alternatively, you can add multiple components with a list. # This can be useful to return from a function. base + list(subset(mpg, fl == "p"), geom_smooth()) base <- ggplot ( mpg , aes ( displ , hwy ) ) + geom_point ( ) base + geom_smooth ( ) # To override the data, you must use %+% base %+% subset ( mpg , fl == "p" ) # Alternatively, you can add multiple components with a list. # This can be useful to return from a function. base + list ( subset ( mpg , fl == "p" ) , geom_smooth ( ) ) Construct aesthetic mappings Description Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms. Aesthetic mappings can be set in ggplot() and in individual layers. Usage aes(x, y, ...) aes ( x , y , ... ) Arguments x , y , ... < data-masking > List of name-value pairs in the form aesthetic = variable describing which variables in the layer data should be mapped to which aesthetics used by the paired geom/stat. The expression variable is evaluated within the layer data, so there is no need to refer to the original dataset (i.e., use ggplot(df, aes(variable)) instead of ggplot(df, aes(df$variable)) ). The names for x and y aesthetics are typically omitted because they are so common; all other aesthetics must be named. Details This function also standardises aesthetic names by converting color to colour (also in substrings, e.g., point_co
field
Colour related aesthetics: colour, fill, and alpha
R-universe · 4.0.3.9000 · Colour related aesthetics: colour, fill, and alpha · text/html; charset=utf-8 · 2,196,703 · 2026-05-07
Title
Package 'ggplot2' reference manual
Label
Colour related aesthetics: colour, fill, and alpha
Text content
Text content
Package 'ggplot2' reference manual Package 'ggplot2' Title: Create Elegant Data Visualisations Using the Grammar of Graphics Description: 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] (ORCID: <https://orcid.org/0000-0003-4757-117X>), Winston Chang [aut] (ORCID: <https://orcid.org/0000-0002-1576-2126>), Lionel Henry [aut], Thomas Lin Pedersen [aut, cre] (ORCID: <https://orcid.org/0000-0002-5147-4711>), Kohske Takahashi [aut], Claus Wilke [aut] (ORCID: <https://orcid.org/0000-0002-7470-9261>), Kara Woo [aut] (ORCID: <https://orcid.org/0000-0002-5125-4188>), Hiroaki Yutani [aut] (ORCID: <https://orcid.org/0000-0002-3385-7233>), Dewey Dunnington [aut] (ORCID: <https://orcid.org/0000-0002-9415-4582>), Teun van den Brand [aut] (ORCID: <https://orcid.org/0000-0002-9335-7468>), Posit, PBC [cph, fnd] (ROR: <https://ror.org/03wc8by49>) Maintainer: Thomas Lin Pedersen < [email protected] > License: MIT + file LICENSE Version: 4.0.3.9000 Built: 2026-04-25 13:56:20 UTC Source: https://github.com/tidyverse/ggplot2 Help Index Add components to a plot Construct aesthetic mappings Colour related aesthetics: colour, fill, and alpha Control aesthetic evaluation Aesthetics: grouping Differentiation related aesthetics: linetype, size, shape Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend Create an annotation layer Create a layer of map borders Annotation: Custom grob Annotation: log tick marks Annotation: a map Annotation: high-performance rectangular tiling Create a ggplot layer appropriate to a particular data type Tailoring plots to particular data types Create a complete ggplot appropriate to a particular data type Cartesian coordinates Cartesian coordinates with fixed "aspect ratio" Cartesian coordinates with x and y flipped Map projections Polar coordinates Transformed Cartesian coordinate system Visualise sf objects Discretise numeric data into categorical Prices of over 50,000 round cut diamonds Key glyphs for legends US economic time series Expand the plot limits, using data Generate expansion vector for scales Lay out panels in a grid Wrap a 1d ribbon of panels into 2d 2d density estimate of Old Faithful data Fortify a model with data. Reference lines: horizontal, vertical, and diagonal Bar charts Heatmap of 2d bin counts Draw nothing A box and whiskers plot (in the style of Tukey) 2D contours of a 3D surface Count overlapping points Vertical intervals: lines, crossbars & errorbars Smoothed density estimates Contours of a 2D density estimate Dot plot Histograms and frequency polygons Draw a function as a continuous curve Hexagonal heatmap of 2d bin counts Jittered points Text Polygons from a reference map Connect observations Points Polygons A quantile-quantile plot Quantile regression Rectangles Ribbons and area plots Rug plots in the margins Line segments and curves Smoothed conditional means Line segments parameterised by location, direction and distance Violin plot Extract alt text from a plot Get, set, and modify the active theme Create a new ggplot Create a new ggproto object Save a ggplot (or other grid object) with sensible defaults Complete themes Axis guide Axis with logarithmic tick marks Stacked axis guides Angle axis guide A binned version of guide_legend Continuous colour bar guide Discretized colourbar guide Custom guides Legend guide Empty guide Set guides for each scale A selection of summary functions from Hmisc Label with mathematical expressions Construct labelling specification Useful labeller functions Modify axis, legend, and plot labels Layer geometry display Layer position adjustments Layer statistical transformations Set scale limits colors() in Luv space Theme elements Calculate mean and standard error of the mean Midwest demographics Fuel economy data from 1999 to 2008 for 38 popular models of cars An updated and expanded version of the mammals sleep dataset Dodge overlapping objects side-to-side Don't adjust position Jitter points to avoid overplotting Simultaneously dodge and jitter Nudge points a fixed distance Stack overlapping objects on top of each another Terms of 12 presidents from Eisenhower to Trump Explicitly draw plot Format or print a ggproto object Quick plot Compute the "resolution" of a numeric vector Alpha transparency scales Positional scales for binning continuous data (x & y) Sequential, diverging and qualitative colour scales from ColorBrewer Continuous and binned colour scales Discrete colour scales Gradient colour scales Sequential grey colour scales Evenly spaced colours for discrete data Binned gradient colour scales Viridis colour scales from viridisLite Position scales for continuous data (x & y) Position scales for date/time data Use values without scaling Scale for line patterns Scales for line width Create your own discrete scale Scales for shapes, aka glyphs Scales for area or radius Position scales for discrete data Vector field of seal movements Specify a secondary axis Connect observations Compute empirical cumulative distribution Compute normal data ellipses Leave data as is Manually compute transformations Extract coordinates from 'sf' objects Bin and summarise in 2d (rectangle & hexagons) Summarise y values at unique/binned x Remove duplicates Shortcuts for theme settings Modify components of a theme Housing sales in TX Quote faceting variables Add components to a plot Description + is the key to constructing sophisticated ggplot2 graphics. It allows you to start simple, then get more and more complex, checking your work at each step. Usage add_gg(e1, e2) e1 %+% e2 add_gg ( e1 , e2 ) e1 %+% e2 Arguments e1 An object of class ggplot() or a theme() . e2 A plot component, as described below. What can you add? You can add any of the following types of objects: An aes() object replaces the default aesthetics. A layer created by a geom_ or stat_ function adds a new layer. A scale overrides the existing scale. A theme() modifies the current theme. A coord overrides the current coordinate system. A facet specification overrides the current faceting. To replace the current default data frame, you must use ⁠%+%⁠ , due to S3 method precedence issues. You can also supply a list, in which case each element of the list will be added in turn. See Also theme() Examples base <- ggplot(mpg, aes(displ, hwy)) + geom_point() base + geom_smooth() # To override the data, you must use %+% base %+% subset(mpg, fl == "p") # Alternatively, you can add multiple components with a list. # This can be useful to return from a function. base + list(subset(mpg, fl == "p"), geom_smooth()) base <- ggplot ( mpg , aes ( displ , hwy ) ) + geom_point ( ) base + geom_smooth ( ) # To override the data, you must use %+% base %+% subset ( mpg , fl == "p" ) # Alternatively, you can add multiple components with a list. # This can be useful to return from a function. base + list ( subset ( mpg , fl == "p" ) , geom_smooth ( ) ) Construct aesthetic mappings Description Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms. Aesthetic mappings can be set in ggplot() and in individual layers. Usage aes(x, y, ...) aes ( x , y , ... ) Arguments x , y , ... < data-masking > List of name-value pairs in the form aesthetic = variable describing which variables in the layer data should be mapped to which aesthetics used by the paired geom/stat. The expression variable is evaluated within the layer data, so there is no need to refer to the original dataset (i.e., use ggplot(df, aes(variable)) instead of ggplot(df, aes(df$variable)) ). The names for x and y aesthetics are typically omitted because they are so common; all other aesthetics must be named. Details This function also standardises aesthetic names by converting color to colour (also in substrings, e.g., point_co
field
Construct aesthetic mappings
R-universe · 4.0.3.9000 · Construct aesthetic mappings · text/html; charset=utf-8 · 2,196,703 · 2026-05-07
Title
Package 'ggplot2' reference manual
Label
Construct aesthetic mappings
Text content
Text content
Package 'ggplot2' reference manual Package 'ggplot2' Title: Create Elegant Data Visualisations Using the Grammar of Graphics Description: 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] (ORCID: <https://orcid.org/0000-0003-4757-117X>), Winston Chang [aut] (ORCID: <https://orcid.org/0000-0002-1576-2126>), Lionel Henry [aut], Thomas Lin Pedersen [aut, cre] (ORCID: <https://orcid.org/0000-0002-5147-4711>), Kohske Takahashi [aut], Claus Wilke [aut] (ORCID: <https://orcid.org/0000-0002-7470-9261>), Kara Woo [aut] (ORCID: <https://orcid.org/0000-0002-5125-4188>), Hiroaki Yutani [aut] (ORCID: <https://orcid.org/0000-0002-3385-7233>), Dewey Dunnington [aut] (ORCID: <https://orcid.org/0000-0002-9415-4582>), Teun van den Brand [aut] (ORCID: <https://orcid.org/0000-0002-9335-7468>), Posit, PBC [cph, fnd] (ROR: <https://ror.org/03wc8by49>) Maintainer: Thomas Lin Pedersen < [email protected] > License: MIT + file LICENSE Version: 4.0.3.9000 Built: 2026-04-25 13:56:20 UTC Source: https://github.com/tidyverse/ggplot2 Help Index Add components to a plot Construct aesthetic mappings Colour related aesthetics: colour, fill, and alpha Control aesthetic evaluation Aesthetics: grouping Differentiation related aesthetics: linetype, size, shape Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend Create an annotation layer Create a layer of map borders Annotation: Custom grob Annotation: log tick marks Annotation: a map Annotation: high-performance rectangular tiling Create a ggplot layer appropriate to a particular data type Tailoring plots to particular data types Create a complete ggplot appropriate to a particular data type Cartesian coordinates Cartesian coordinates with fixed "aspect ratio" Cartesian coordinates with x and y flipped Map projections Polar coordinates Transformed Cartesian coordinate system Visualise sf objects Discretise numeric data into categorical Prices of over 50,000 round cut diamonds Key glyphs for legends US economic time series Expand the plot limits, using data Generate expansion vector for scales Lay out panels in a grid Wrap a 1d ribbon of panels into 2d 2d density estimate of Old Faithful data Fortify a model with data. Reference lines: horizontal, vertical, and diagonal Bar charts Heatmap of 2d bin counts Draw nothing A box and whiskers plot (in the style of Tukey) 2D contours of a 3D surface Count overlapping points Vertical intervals: lines, crossbars & errorbars Smoothed density estimates Contours of a 2D density estimate Dot plot Histograms and frequency polygons Draw a function as a continuous curve Hexagonal heatmap of 2d bin counts Jittered points Text Polygons from a reference map Connect observations Points Polygons A quantile-quantile plot Quantile regression Rectangles Ribbons and area plots Rug plots in the margins Line segments and curves Smoothed conditional means Line segments parameterised by location, direction and distance Violin plot Extract alt text from a plot Get, set, and modify the active theme Create a new ggplot Create a new ggproto object Save a ggplot (or other grid object) with sensible defaults Complete themes Axis guide Axis with logarithmic tick marks Stacked axis guides Angle axis guide A binned version of guide_legend Continuous colour bar guide Discretized colourbar guide Custom guides Legend guide Empty guide Set guides for each scale A selection of summary functions from Hmisc Label with mathematical expressions Construct labelling specification Useful labeller functions Modify axis, legend, and plot labels Layer geometry display Layer position adjustments Layer statistical transformations Set scale limits colors() in Luv space Theme elements Calculate mean and standard error of the mean Midwest demographics Fuel economy data from 1999 to 2008 for 38 popular models of cars An updated and expanded version of the mammals sleep dataset Dodge overlapping objects side-to-side Don't adjust position Jitter points to avoid overplotting Simultaneously dodge and jitter Nudge points a fixed distance Stack overlapping objects on top of each another Terms of 12 presidents from Eisenhower to Trump Explicitly draw plot Format or print a ggproto object Quick plot Compute the "resolution" of a numeric vector Alpha transparency scales Positional scales for binning continuous data (x & y) Sequential, diverging and qualitative colour scales from ColorBrewer Continuous and binned colour scales Discrete colour scales Gradient colour scales Sequential grey colour scales Evenly spaced colours for discrete data Binned gradient colour scales Viridis colour scales from viridisLite Position scales for continuous data (x & y) Position scales for date/time data Use values without scaling Scale for line patterns Scales for line width Create your own discrete scale Scales for shapes, aka glyphs Scales for area or radius Position scales for discrete data Vector field of seal movements Specify a secondary axis Connect observations Compute empirical cumulative distribution Compute normal data ellipses Leave data as is Manually compute transformations Extract coordinates from 'sf' objects Bin and summarise in 2d (rectangle & hexagons) Summarise y values at unique/binned x Remove duplicates Shortcuts for theme settings Modify components of a theme Housing sales in TX Quote faceting variables Add components to a plot Description + is the key to constructing sophisticated ggplot2 graphics. It allows you to start simple, then get more and more complex, checking your work at each step. Usage add_gg(e1, e2) e1 %+% e2 add_gg ( e1 , e2 ) e1 %+% e2 Arguments e1 An object of class ggplot() or a theme() . e2 A plot component, as described below. What can you add? You can add any of the following types of objects: An aes() object replaces the default aesthetics. A layer created by a geom_ or stat_ function adds a new layer. A scale overrides the existing scale. A theme() modifies the current theme. A coord overrides the current coordinate system. A facet specification overrides the current faceting. To replace the current default data frame, you must use ⁠%+%⁠ , due to S3 method precedence issues. You can also supply a list, in which case each element of the list will be added in turn. See Also theme() Examples base <- ggplot(mpg, aes(displ, hwy)) + geom_point() base + geom_smooth() # To override the data, you must use %+% base %+% subset(mpg, fl == "p") # Alternatively, you can add multiple components with a list. # This can be useful to return from a function. base + list(subset(mpg, fl == "p"), geom_smooth()) base <- ggplot ( mpg , aes ( displ , hwy ) ) + geom_point ( ) base + geom_smooth ( ) # To override the data, you must use %+% base %+% subset ( mpg , fl == "p" ) # Alternatively, you can add multiple components with a list. # This can be useful to return from a function. base + list ( subset ( mpg , fl == "p" ) , geom_smooth ( ) ) Construct aesthetic mappings Description Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms. Aesthetic mappings can be set in ggplot() and in individual layers. Usage aes(x, y, ...) aes ( x , y , ... ) Arguments x , y , ... < data-masking > List of name-value pairs in the form aesthetic = variable describing which variables in the layer data should be mapped to which aesthetics used by the paired geom/stat. The expression variable is evaluated within the layer data, so there is no need to refer to the original dataset (i.e., use ggplot(df, aes(variable)) instead of ggplot(df, aes(df$variable)) ). The names for x and y aesthetics are typically omitted because they are so common; all other aesthetics must be named. Details This function also standardises aesthetic names by converting color to colour (also in substrings, e.g., point_co

Reference for ggplot2 (4.0.3)

80개 topic
Coord
Coords
CRAN · 4.0.3 · data · ggplot2/man/Coord.Rd · 2026-05-07

All coord_*() functions (like coord_transform()) return a Coord* object (like CoordTransform). These objects contain methods that support the coordinate systems in ggplot2.

Aliases
CoordCoordCartesianCoordFixedCoordFlipCoordMapCoordPolarCoordQuickmapCoordRadialCoordTransformCoordTrans
Keywords
datasetsinternal
Concepts
Layout components
Details
Each of the Coord* objects is a [=ggproto]ggproto() object, descended from the top-level Coord, and each implements various methods and fields. The object and its parameters are chaperoned by the Layout class. To create a new type of Coord object, it is recommended to extend not the base Coord class, but one of its children like CoordCartesian. When overriding the transform() method, it may be necessary to adapt the implementation of render_bg() and possibly axis placement too. An important data structure that coordinate systems create is the panel_params structure. When overriding that structure, many methods may need to be adapted as well.
Examples
# Extending the class CoordJitter <- ggproto( "CoordJitter", CoordCartesian, # Fields amount = 0, # Methods is_linear = function() FALSE, transform = function(self, data, panel_params) data <- ggproto_parent(CoordCartesian, self)$transform(data, panel_params) data$x <- jitter(data$x, amount = self$amount) data$y <- jitter(data$y, amount = self$amount) data ) # Building a constructor coord_jitter <- function(amount = 0.005, xlim = NULL, ylim = NULL, expand = TRUE, clip = "on", reverse = "none") ggproto( NULL, CoordJitter, amount = amount, limits = list(x = xlim, y = ylim), reverse = reverse, expand = expand, clip = clip ) # Use new coord in plot set.seed(42) ggplot(mpg, aes(drv, displ)) + geom_boxplot() + coord_jitter()
See also
The https://ggplot2-book.org/extensions#sec-new-coordsnew coords section of the online ggplot2 book. Other Layout components: Facet, Layout
Custom sections
Fields
defaultScaler boolean indicating whether this is the default coordinate system. Non-default coordinate systems raise a message when a new system replaces it. clipA scalar string grid setting controlling whether layers should be clipped to the extent of the plot panel extent. Can be "on" to perform clipping, "off" to not clip, or "inherit" to take on the setting of the parent viewport. reverseA scalar string giving which directions to reverse. For Cartesian systems, can be "none, "x", "y" or "xy" for both. Non-Cartesian may define their own settings. setup_paramsDescription A function method for modifying or checking the parameters based on the data. The default method parses the expand parameter. Usage html<div class="sourceCode r">Coord$setup_params(data) html</div> Arguments dataA list of data frames. The first item is the global data, which is followed by layer data in subsequent items. Value A list of parameters setup_dataDescription A function method for modifying or checking the data prior to adding defaults. The default method returns data unaltered. Usage html<div class="sourceCode r">Coord$setup_data(data, params) html</div> Arguments dataA list of data frames. The first item is the global data, which is followed by layer data in subsequent items. paramsA list of parameters coming from the setup_params() method. Value A list of data frames of the same length as the data argument setup_layoutDescription A function method that acts as a hook for the coordinate system to have input on the layout computed by facets. Usage html<div class="sourceCode r">Coord$setup_layout(layout, params) html</div> Arguments layoutA data frame computed by Facet$compute_layout(). Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. paramsA list of parameters coming from the setup_params() method. Value A data frame from the modified layout argument. The default creates a new COORD column to identify unique combinations of x and y scales for efficiency purposes. It should never remove columns. modify_scalesDescription A function method for modifying scales in place. This is optional and currently used by CoordFlip and CoordPolar to ensure axis positions are conforming to the coordinate system. Usage html<div class="sourceCode r">Coord$modify_scales(scales_x, scales_y) html</div> Arguments scales_x,scales_yA list of trained scales for the x and y aesthetics respectively. Value Nothing, this is called for the side effect of modifying scales. setup_panel_paramsDescription This function method is used to setup panel parameters per panel. For efficiency reasons, this method is called once per combination of x and y scales. It is used to instantiate ViewScale class objects and ranges for position aesthetics and optionally append additional parameters needed for the transform() method and rendering axes. Usage html<div class="sourceCode r">Coord$setup_panel_params(scale_x, scale_y, params) html</div> Arguments scale_x,scale_yA list of trained scales for the x and y aesthetics respectively. paramsA list of parameters coming from the setup_params() method. Value A named list of view scales, ranges and other optional parameters. setup_panel_guidesDescription This function method is used to initiate position guides for each panel. For efficiency reasons, this method is called once per combination of x and y scales. For the primary and secondary positions, it should resolve guides coming from the plot$guides field and Scale$guide fields and set appropriate Guide$params$position parameters. Usage html<div class="sourceCode r">Coord$setup_panel_guides(panel_params, guides, params) html</div> Arguments panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. guidesA <Guides> ggproto class. paramsA list of parameters coming from the setup_params() method. Value The panel_params object but with a Guides class object appended with the name 'guides'. setup_panel_guidesDescription This function method is used to train and transform position guides for each panel. For efficiency reasons, this method is called once per combination of x and y scales. Usage html<div class="sourceCode r">Coord$train_panel_guides(panel_params, layers, params) html</div> Arguments panel_paramsA list of ViewScale class objects, a Guides class object and additional parameters from the setup_panel_params() method. layersA list of layers from plot$layers. paramsA list of parameters coming from the setup_params() method. Value The panel_params object, but with trained and transformed guides parameter. transformDescription This function method is used to apply transformations and rescale position aesthetics. This method is used in several places: The Geom drawing code, used through coord_munch() in many Geoms. The Guide transform method Panel grid transformation in render_bg() Usage html<div class="sourceCode r">Coord$transform(data, panel_params) html</div> Arguments dataA data frame with columns for numeric position aesthetics. panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. Value The data argument with rescaled and transformed position aesthetics. distanceDescription This function method is used to calculate distances between subsequent data points. coord_munch() uses this method determine how many points should be used to interpolate. Usage html<div class="sourceCode r">Coord$distance(x, y, panel_params) html</div> Arguments x,yx and y coordinates of a set of points in data space. panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. Value The data argument with rescaled and transformed position aesthetics. backtransform_rangeDescription This function method is used to convert ranges from transformed coordinates back into data coordinates. The data coordinates may possibly be scale- transformed. It is used in coord_munch() to ensure limits are in data coordinates. The back-transformation may be needed for coords such as coord_transform(), where the range in the transformed coordinates differs from the range in the untransformed coordinates. Usage html<div class="sourceCode r">Coord$backtransform_range(panel_params) html</div> Arguments panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. Value A list containing numeric ranges for x and y in data coordinates. rangeDescription This function method is a small helper method to extract ranges from the panel_params object. It exists because panel_params can be opaque at times. Usage html<div class="sourceCode r">Coord$range(panel_params) html</div> Arguments panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. Value A list containing numeric ranges for x and y. draw_panelDescription This function method is used to orchestrate decorating panel drawings with foreground and background drawings. It is called once per panel, invokes the render_fg() and render_bg() methods and enforces the clip field. Usage html<div class="sourceCode r">Coord$draw_panel(panel, params, theme) html</div> Arguments panelA grob containing drawn layers and facet foreground and background. paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. themeA [=complete_theme]complete theme Value A grob with panel content. render_fgDescription This function method is used to draw the panel foreground. For all intents and purposes is just the panel.border theme element, but you can repurpose this method. Usage html<div class="sourceCode r">Coord$render_fg(panel_params, theme) html</div> Arguments panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. themeA [=complete_theme]complete theme Value A grob with panel foreground. render_bgDescription This function method is used to draw the panel background. Typically this is a combination of the panel.background and panel.grid theme elements. Usage html<div class="sourceCode r">Coord$render_bg(panel_params, theme) html</div> Arguments panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. themeA [=complete_theme]complete theme Value A grob with panel background. labelsDescription This function method is used to format axis titles. It is used in some coordinate systems to (conditionally) swap x and y labels. Usage html<div class="sourceCode r">Coord$labels(labels, panel_params) html</div> Arguments labelsA named list containing an x list and a y list. The x and y lists have primary and secondary labels. panel_paramsA list of ViewScale class objects and additional parameters from the setup_panel_params() method. Value A list with the same structure and names as the labels argument. aspectDescription This function method that gives the aspect ratio for panels. It allows for CoordFixed to compute an aspect ratio based on data ranges. Usage html<div class="sourceCode r">Coord$render_bg(panel_params, theme) html</div> Arguments rangesA list of ViewScale class objects and additional parameters from the setup_panel_params() method. If there are multiple panels, the parameters for the first panel is used. Value A scalar numeric render_axis_h,render_axis_vDescription These function methods are used to render axes to place at the outside edge of panels. Interior axes should not be rendered here. The render_axis_h() methods produces the horizontal axes for the top and bottom position. The render_axis_v() method renders the vertical axes for the left and right position. Usage html<div class="sourceCode r">Coord$render_axis_h(panel_params, theme Coord$render_axis_v(panel_params, theme) html</div> Arguments panel_paramsA list of ViewScale class objects, a Guides class object and additional parameters from the setup_panel_params() method. themeA [=complete_theme]complete theme Value For render_axis_h() a named list where "top" and "bottom" are grobs with an axis. For render_axis_v() a named list where "left" and "right" are grobs with an axis. These grobs should be [=zeroGrob]zeroGrob() when no axes should be rendered. is_linearDescription This function method is used to signal whether a coordinate system is linear. In coord_munch() and several Geom drawing methods, it is used to determine whether points should be interpolated. Usage html<div class="sourceCode r">Coord$is_linear() html</div> Value A scalar boolean. is_freeDescription This function method is used to signal whether a coordinate system supports free scaling of axes in faceted plots. This should generally return FALSE for coordinate systems that enforce a fixed aspect ratio. Usage html<div class="sourceCode r">Coord$is_free() html</div> Value A scalar boolean.
Conventions
The object name that a new class is assigned to is typically the same as the class name. Coord class names are in UpperCamelCase and start with the Coord* prefix, like CoordNew. A constructor function is usually paired with a Coord class. The constructor copies the coord class and populates parameters. The constructor function name should take the Coord class name and be formatted with snake_case, so that CoordNew becomes coord_new().
CoordSf
Visualise sf objects
CRAN · 4.0.3 · data · ggplot2/man/ggsf.Rd · 2026-05-07

This set of geom, stat, and coord are used to visualise simple feature (sf) objects. For simple plots, you will only need geom_sf() as it uses stat_sf() and adds coord_sf() for you. geom_sf() is an unusual geom because it will draw different geometric objects depending on what simple features are present in the data: you can get points, lines, or polygons. For text and labels, you can use geom_sf_text() and geom_sf_label().

Aliases
CoordSfcoord_sfggsfGeomSfgeom_sfgeom_sf_labelgeom_sf_textStatSfstat_sf
Keywords
datasets
Usage
coord_sf( xlim = NULL, ylim = NULL, expand = TRUE, crs = NULL, default_crs = NULL, datum = sf::st_crs(4326), label_graticule = waiver(), label_axes = waiver(), lims_method = "cross", ndiscr = 100, default = FALSE, clip = "on", reverse = "none" ) geom_sf( mapping = aes(), data = NULL, stat = "sf", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) geom_sf_label( mapping = aes(), data = NULL, stat = "sf_coordinates", position = "nudge", ..., parse = FALSE, label.padding = unit(0.25, "lines"), label.r = unit(0.15, "lines"), label.size = deprecated(), border.colour = NULL, border.color = NULL, text.colour = NULL, text.color = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, fun.geometry = NULL ) geom_sf_text( mapping = aes(), data = NULL, stat = "sf_coordinates", position = "nudge", ..., parse = FALSE, check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, fun.geometry = NULL ) stat_sf( mapping = NULL, data = NULL, geom = "rect", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )
Arguments
xlim, ylim
Limits for the x and y axes. These limits are specified in the units of the default CRS. By default, this means projected coordinates (default_crs = NULL). How limit specifications translate into the exact region shown on the plot can be confusing when non-linear or rotated coordinate systems are used as the default crs. First, different methods can be preferable under different conditions. See parameter lims_method for details. Second, specifying limits along only one direction can affect the automatically generated limits along the other direction. Therefore, it is best to always specify limits for both x and y. Third, specifying limits via position scales or xlim()/ylim() is strongly discouraged, as it can result in data points being dropped from the plot even though they would be visible in the final plot region.
expand
If TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim. Giving a logical vector will separately control the expansion for the four directions (top, left, bottom and right). The expand argument will be recycled to length 4 if necessary. Alternatively, can be a named logical vector to control a single direction, e.g. expand = c(bottom = FALSE).
crs
The coordinate reference system (CRS) into which all data should be projected before plotting. If not specified, will use the CRS defined in the first sf layer of the plot.
default_crs
The default CRS to be used for non-sf layers (which don't carry any CRS information) and scale limits. The default value of NULL means that the setting for crs is used. This implies that all non-sf layers and scale limits are assumed to be specified in projected coordinates. A useful alternative setting is default_crs = sf::st_crs(4326), which means x and y positions are interpreted as longitude and latitude, respectively, in the World Geodetic System 1984 (WGS84).
datum
CRS that provides datum to use when generating graticules.
label_graticule
Character vector indicating which graticule lines should be labeled where. Meridians run north-south, and the letters "N" and "S" indicate that they should be labeled on their north or south end points, respectively. Parallels run east-west, and the letters "E" and "W" indicate that they should be labeled on their east or west end points, respectively. Thus, label_graticule = "SW" would label meridians at their south end and parallels at their west end, whereas label_graticule = "EW" would label parallels at both ends and meridians not at all. Because meridians and parallels can in general intersect with any side of the plot panel, for any choice of label_graticule labels are not guaranteed to reside on only one particular side of the plot panel. Also, label_graticule can cause labeling artifacts, in particular if a graticule line coincides with the edge of the plot panel. In such circumstances, label_axes will generally yield better results and should be used instead. This parameter can be used alone or in combination with label_axes.
label_axes
Character vector or named list of character values specifying which graticule lines (meridians or parallels) should be labeled on which side of the plot. Meridians are indicated by "E" (for East) and parallels by "N" (for North). Default is "--EN", which specifies (clockwise from the top) no labels on the top, none on the right, meridians on the bottom, and parallels on the left. Alternatively, this setting could have been specified with list(bottom = "E", left = "N"). This parameter can be used alone or in combination with label_graticule.
lims_method
Method specifying how scale limits are converted into limits on the plot region. Has no effect when default_crs = NULL. For a very non-linear CRS (e.g., a perspective centered around the North pole), the available methods yield widely differing results, and you may want to try various options. Methods currently implemented include "cross" (the default), "box", "orthogonal", and "geometry_bbox". For method "cross", limits along one direction (e.g., longitude) are applied at the midpoint of the other direction (e.g., latitude). This method avoids excessively large limits for rotated coordinate systems but means that sometimes limits need to be expanded a little further if extreme data points are to be included in the final plot region. By contrast, for method "box", a box is generated out of the limits along both directions, and then limits in projected coordinates are chosen such that the entire box is visible. This method can yield plot regions that are too large. Finally, method "orthogonal" applies limits separately along each axis, and method "geometry_bbox" ignores all limit information except the bounding boxes of any objects in the geometry aesthetic.
ndiscr
Number of segments to use for discretising graticule lines; try increasing this number when graticules look incorrect.
default
Is this the default coordinate system? If FALSE (the default), then replacing this coordinate system with another one creates a message alerting the user that the coordinate system is being replaced. If TRUE, that warning is suppressed.
clip
Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. In most cases, the default of "on" should not be changed, as setting clip = "off" can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via xlim and ylim and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins.
reverse
A string giving which directions to reverse. "none" (default) keeps directions as is. "x" and "y" can be used to reverse their respective directions. "xy" can be used to reverse both directions.
mapping
Set of aesthetic mappings created by [=aes]aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.
data
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to [=ggplot]ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See [=fortify]fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).
stat
The statistical transformation to use on the data for this layer. When using a geom_*() function to construct a layer, the stat argument can be used to override the default coupling between geoms and stats. The stat argument accepts the following: A Stat ggproto subclass, for example StatCount. A string naming the stat. To give the stat as a string, strip the function name of the stat_ prefix. For example, to use stat_count(), give the stat as "count". For more information and other ways to specify the stat, see the [=layer_stats]layer stat documentation.
position
A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following: The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position. A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter". For more information and other ways to specify the position, see the [=layer_positions]layer position documentation.
na.rm
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. You can also set this to one of "polygon", "line", and "point" to override the default legend.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. [=annotation_borders]annotation_borders().
...
Other arguments passed on to [=layer]layer()'s params argument. These arguments broadly fall into one of 4 categories below. Notably, further arguments to the position argument, or aesthetics that are required can not be passed through .... Unknown arguments that are not part of the 4 categories below are ignored. Static aesthetics that are not mapped to a scale, but are at a fixed value and apply to the layer as a whole. For example, colour = "red" or linewidth = 3. The geom's documentation has an Aesthetics section that lists the available options. The 'required' aesthetics cannot be passed on to the params. Please note that while passing unmapped aesthetics as vectors is technically possible, the order and required length is not guaranteed to be parallel to the input data. When constructing a layer using a stat_*() function, the ... argument can be used to pass on parameters to the geom part of the layer. An example of this is stat_density(geom = "area", outline.type = "both"). The geom's documentation lists which parameters it can accept. Inversely, when constructing a layer using a geom_*() function, the ... argument can be used to pass on parameters to the stat part of the layer. An example of this is geom_area(stat = "density", adjust = 0.5). The stat's documentation lists which parameters it can accept. The key_glyph argument of [=layer]layer() may also be passed on through .... This can be one of the functions described as [=draw_key]key glyphs, to change the display of the layer in the legend.
parse
If TRUE, the labels will be parsed into expressions and displayed as described in ?plotmath.
label.padding
Amount of padding around label. Defaults to 0.25 lines.
label.r
Radius of rounded corners. Defaults to 0.15 lines.
label.size
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] Replaced by the linewidth aesthetic. Size of label border, in mm.
border.colour, border.color
Colour of label border. When NULL (default), the colour aesthetic determines the colour of the label border. border.color is an alias for border.colour.
text.colour, text.color
Colour of the text. When NULL (default), the colour aesthetic determines the colour of the text. text.color is an alias for text.colour.
fun.geometry
A function that takes a sfc object and returns a sfc_POINT with the same length as the input. If NULL, function(x) sf::st_point_on_surface(sf::st_zm(x)) will be used. Note that the function may warn about the incorrectness of the result if the data is not projected, but you can ignore this except when you really care about the exact locations.
check_overlap
If TRUE, text that overlaps previous text in the same layer will not be plotted. check_overlap happens at draw time and in the order of the data. Therefore data should be arranged by the label column before calling geom_text(). Note that this argument is not supported by geom_label().
geom
The geometric object to use to display the data for this layer. When using a stat_*() function to construct a layer, the geom argument can be used to override the default coupling between stats and geoms. The geom argument accepts the following: A Geom ggproto subclass, for example GeomPoint. A string naming the geom. To give the geom as a string, strip the function name of the geom_ prefix. For example, to use geom_point(), give the geom as "point". For more information and other ways to specify the geom, see the [=layer_geoms]layer geom documentation.
Examples
if (requireNamespace("sf", quietly = TRUE)) nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) ggplot(nc) + geom_sf(aes(fill = AREA)) # If not supplied, coord_sf() will take the CRS from the first layer # and automatically transform all other layers to use that CRS. This # ensures that all data will correctly line up nc_3857 <- sf::st_transform(nc, 3857) ggplot() + geom_sf(data = nc) + geom_sf(data = nc_3857, colour = "red", fill = NA) # Unfortunately if you plot other types of feature you'll need to use # show.legend to tell ggplot2 what type of legend to use nc_3857$mid <- sf::st_centroid(nc_3857$geometry) ggplot(nc_3857) + geom_sf(colour = "white") + geom_sf(aes(geometry = mid, size = AREA), show.legend = "point") # You can also use layers with x and y aesthetics. To have these interpreted # as longitude/latitude you need to set the default CRS in coord_sf() ggplot(nc_3857) + geom_sf() + annotate("point", x = -80, y = 35, colour = "red", size = 4) + coord_sf(default_crs = sf::st_crs(4326)) # To add labels, use geom_sf_label(). ggplot(nc_3857[1:3, ]) + geom_sf(aes(fill = AREA)) + geom_sf_label(aes(label = NAME)) # Thanks to the power of sf, a geom_sf nicely handles varying projections # setting the aspect ratio correctly. if (requireNamespace('maps', quietly = TRUE)) library(maps) world1 <- sf::st_as_sf(map('world', plot = FALSE, fill = TRUE)) ggplot() + geom_sf(data = world1) world2 <- sf::st_transform( world1, "+proj=laea +y_0=0 +lon_0=155 +lat_0=-90 +ellps=WGS84 +no_defs" ) ggplot() + geom_sf(data = world2)
See also
The https://ggplot2-book.org/maps#sec-sfsimple feature maps section of the online ggplot2 book. [=stat_sf_coordinates]stat_sf_coordinates()
Custom sections
Geometry aesthetic
geom_sf() uses a unique aesthetic: geometry, giving an column of class sfc containing simple features data. There are three ways to supply the geometry aesthetic: Do nothing: by default geom_sf() assumes it is stored in the geometry column. Explicitly pass an sf object to the data argument. This will use the primary geometry column, no matter what it's called. Supply your own using aes(geometry = my_column) Unlike other aesthetics, geometry will never be inherited from the plot.
CRS
coord_sf() ensures that all layers use a common CRS. You can either specify it using the crs param, or coord_sf() will take it from the first layer that defines a CRS.
Combining sf layers and regular geoms
Most regular geoms, such as [=geom_point]geom_point(), [=geom_path]geom_path(), [=geom_text]geom_text(), [=geom_polygon]geom_polygon() etc. will work fine with coord_sf(). However when using these geoms, two problems arise. First, what CRS should be used for the x and y coordinates used by these non-sf geoms? The CRS applied to non-sf geoms is set by the default_crs parameter, and it defaults to NULL, which means positions for non-sf geoms are interpreted as projected coordinates in the coordinate system set by the crs parameter. This setting allows you complete control over where exactly items are placed on the plot canvas, but it may require some understanding of how projections work and how to generate data in projected coordinates. As an alternative, you can set default_crs = sf::st_crs(4326), the World Geodetic System 1984 (WGS84). This means that x and y positions are interpreted as longitude and latitude, respectively. You can also specify any other valid CRS as the default CRS for non-sf geoms. The second problem that arises for non-sf geoms is how straight lines should be interpreted in projected space when default_crs is not set to NULL. The approach coord_sf() takes is to break straight lines into small pieces (i.e., segmentize them) and then transform the pieces into projected coordinates. For the default setting where x and y are interpreted as longitude and latitude, this approach means that horizontal lines follow the parallels and vertical lines follow the meridians. If you need a different approach to handling straight lines, then you should manually segmentize and project coordinates and generate the plot in projected coordinates.
Facet
Facets
CRAN · 4.0.3 · data · ggplot2/man/Facet.Rd · 2026-05-07

All facet_*() functions returns a Facet object or an object of a Facet subclass. This object describes how to assign data to different panels, how to apply positional scales and how to lay out the panels, once rendered.

Aliases
FacetFacetGridFacetNullFacetWrap
Keywords
datasetsinternal
Concepts
Layout components
Details
Extending facets can range from the simple modifications of current facets, to very laborious rewrites with a lot of [gtable:gtable]gtable() manipulation.For some examples of both, please see the extension vignette. The object and its parameters are chaperoned by the Layout class. Facet subclasses, like other extendible ggproto classes, have a range of methods that can be modified. Some of these are required for all new subclasses, while other only need to be modified if need arises. The required methods are: compute_layout map_data() draw_panels() or its subsidiaries: init_gtable() attach_axes() attach_strips() In addition to the methods above, it can be useful to override the default behaviour of one or more of the following methods: setup_params() init_scales() train_scale() finish_data() draw_back(), draw_front() or draw_labels() All extension methods receive the content of the params field as the params argument, so the constructor function will generally put all relevant information into this field.
Examples
# Please see extension vignette NULL
See also
The the https://ggplot2-book.org/extensions#new-facetsnew facets section of the online ggplot2 book. Run vignette("extending-ggplot2"), in particular the "Creating a new faceting" section. Other Layout components: Coord, Layout
Custom sections
Fields
shinkA scalar boolean which when TRUE, will shrink scales to fit output statistics rather than raw data. If FALSE, will only include raw data before statistical summary. By exception this is not part of the params field. paramsA named list of parameters populated by the constructor function. setup_paramsDescription A function method for modifying or checking the parameters based on the data. The default method includes a .possible_columns variable giving column names. Usage html<div class="sourceCode r">Facet$setup_params(data, params) html</div> Arguments dataA list of data frames. The first item is the global data, which is followed by layer data in subsequent items. paramsA list of current parameters. Value A list of parameters setup_dataDescription A function method for modifying or checking the data prior to adding defaults. The default method returns data unaltered. Usage html<div class="sourceCode r">Facet$setup_data(data, params) html</div> Arguments dataA list of data frames. The first item is the global data, which is followed by layer data in subsequent items. paramsA list of parameters coming from the setup_params() method. Value A list of data frames of the same length as the data argument compute_layoutDescription A function method for creating the correspondence between faceting variable levels, panels and position scales. It places panels like cells in a matrix. Usage html<div class="sourceCode r">Facet$compute_layout(data, params) html</div> Arguments dataA list of data frames. The first item is the global data, which is followed by layer data in subsequent items. paramsA list of parameters coming from the setup_params() method. Value A data frame with 1 row per panel, containing at least integer columns ROW, COL, PANEL, SCALE_X and SCALE_Y. Can contain additional information in terms of columns, typically faceting variables. map_dataDescription A function method for to create the PANEL variable in layer data. The PANEL variable is a special variable that tracks the relationship between rows in the layer data and the panels described in the layout input. In addition, #' this function may copy or discard rows as needed, for example when adding margins in FacetGrid. Usage html<div class="sourceCode r">Facet$map_data(data, layout, params) html</div> Arguments dataA list of data frames containing layer data. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. paramsA list of parameters coming from the setup_params() method. Value A list of data frames containing layer data including a PANEL variable. init_scalesDescription A function method for initialising position scales. Given a prototype scale for x and y, creates layout specific scales to accommodate the relationships between panels and scales. By default, the prototype scales are cloned for each SCALE_X and SCALE_Y level. The function is called separately; once for x and once for y. Usage html<div class="sourceCode r">Facet$init_scales(layout, x_scale, y_scale, params) html</div> Arguments layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. x_scale,y_scaleA position scale for the x and y aesthetics respectively. paramsA list of parameters coming from the setup_params() method. Value A named list with x and y elements containing a list of panel scales for each SCALE_X and/or SCALE_Y level respectively. train_scalesDescription A function method for training position scales. The default trains each scale on the data related to its panels. Usage html<div class="sourceCode r">Facet$train_scales(x_scales, y_scales, layout, data, params) html</div> Arguments x_scales,y_scalesA list of panel scales for each SCALE_X and SCALE_Y level respectively. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. dataA list of data frames containing layer data. paramsA list of parameters coming from the setup_params() method. Value Nothing, this method is called for its side-effect of training the scales. setup_panel_paramsDescription A function method as a hook to give facets input over panel parameters. By default, returns panel parameters unaltered. Usage html<div class="sourceCode r">Facet$setup_panel_params(panel_params, coord, ...) html</div> Arguments panel_paramsA named list of view scales, ranges and other optional parameters from Coord$setup_panel_params(). coordA <Coord> ggproto object. ...Currently not in use. For future expansion. Value A list of panel parameters. finish_dataDescription A function method as a hook for making last-minute modifications to layer data before it is rendered by Geoms. The default is to not modify the data. Usage html<div class="sourceCode r">Facet$finish_data(data, layout, x_scales, y_scales, params) html</div> Arguments dataA data frame containing layer data of a single layer. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. x_scales,y_scalesA list of panel scales for each SCALE_X and SCALE_Y level respectively. paramsA list of parameters coming from the setup_params() method. Value A data frame containing layer data. draw_panel_contentDescription A function method to assemble the panel contents. It delegates the draw_back() and draw_front() methods, as well as Coord$draw_panel(). Usage html<div class="sourceCode r">Facet$draw_panel_content( panels, layout, x_scales, y_scales, ranges, coord, theme, params, ... ) html</div> Arguments panelsA list parallel to layers. Each element is another list with grobs for each panel, generated by Layer$draw_geom(). layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. x_scales,y_scalesA list of panel scales for each SCALE_X and SCALE_Y level respectively. rangesA list of panel parameters from the setup_panel_params() augmented with position guides. coordA <Coord> ggproto object. dataA list of data frames containing layer data. themeA [=complete_theme]complete theme object. paramsA list of parameters coming from the setup_params() method. ...Currently not in use. Value A list of grobs, one for each level of the PANEL layout variable. Grob can be zeroGrob() to draw nothing. draw_back,draw_frontDescription A function method draw facet background (back) and foreground (front) for panels. The front and back will sandwich the grobs created by layers. The default methods draw nothing. Usage html<div class="sourceCode r">Facet$draw_back(data, layout, x_scales, y_scales, theme, params) Facet$draw_front(data, layout, x_scales, y_scales, theme, params) html</div> Arguments dataA list of data frames containing layer data. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. x_scales,y_scalesA list of panel scales for each SCALE_X and SCALE_Y level respectively. themeA [=complete_theme]complete theme object. paramsA list of parameters coming from the setup_params() method. Value A list of grobs, one for each level of the PANEL layout variable. Grob can be zeroGrob() to draw nothing. draw_panelsDescription A function method that orchestrates the majority of facet drawing. It is responsible for assembling a gtable with panel content decorated with axes and strips. The resulting gtable is the basis for the plot in its entirety. It delegates these tasks to the init_gtable(), attach_axes() and attach_strips() methods. Usage html<div class="sourceCode r">Facet$draw_panels( panels, layout, x_scales, y_scales, ranges, coord, data, theme, params ) html</div> Arguments panelsA list of grobs, one per panel. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. x_scales,y_scalesA list of panel scales for each SCALE_X and SCALE_Y level respectively. rangesA list of panel parameters from the setup_panel_params() augmented with position guides. coordA <Coord> ggproto object. dataA list of data frames containing layer data. themeA [=complete_theme]complete theme object. paramsA list of parameters coming from the setup_params() method. Value A [gtable:gtable]gtable object. init_gtableDescription A function method that initiates a gtable object containing panels set at the appropriate ROW and COL cells from the layout. The panels are separated by the panel.spacing.\x/y\ spacing. Usage html<div class="sourceCode r">Facet$init_gtable(panels, layout, theme, ranges, params, aspect_ratio) html</div> Arguments panelsA list of grobs, one per panel. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. themeA [=complete_theme]complete theme object. rangesA list of panel parameters from the setup_panel_params() augmented with position guides. aspect_ratioA scalar numeric for the panel aspect ratio or NULL for no aspect ratio. Value A [gtable:gtable]gtable object containing panel grobs prefixed with "panel". attach_axesDescription A function method that renders position guides (axes) and attaches these to the gtable with panels. The default method returns the gtable unaltered. Usage html<div class="sourceCode r">Facet$attach_axes(table, layout, ranges, coord, theme, params) html</div> Arguments tableA [gtable:gtable]gtable object populated with panels from the init_gtable() method. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. rangesA list of panel parameters from the setup_panel_params() augmented with position guides. coordA <Coord> ggproto object. themeA [=complete_theme]complete theme object. paramsA list of parameters coming from the setup_params() method. Value A [gtable:gtable]gtable object. attach_stripsDescription A function method that renders strips and attaches these to the gtable with panels and axes. The format_strip_labels() method is used to format the strip text. The default method returns the gtable unaltered. Usage html<div class="sourceCode r">Facet$attach_strips(table, layout, ranges, coord, theme, params) html</div> Arguments tableA [gtable:gtable]gtable object from the attach_axes() method. layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. paramsA list of parameters coming from the setup_params() method. themeA [=complete_theme]complete theme object. Value A [gtable:gtable]gtable object. format_strip_labelsDescription A function method that formats the text for strips. It is used in the attach_strips methods, but also the get_strip_labels() function. The default method returns NULL. Usage html<div class="sourceCode r">Facet$format_strip_labels(layout, params) html</div> Arguments layoutA data frame computed by the compute_layout() method. Typically contains the faceting variables, ROW, COL, PANEL, SCALE_X and SCALE_Y variables. paramsA list of parameters coming from the setup_params() method. Value A list containing a data frame with strip labels. set_panel_sizeDescription A function method that enforces the panel.widths and panel.heights theme settings. Usage html<div class="sourceCode r">Facet$set_panel_size(table, theme) html</div> Arguments tableA [gtable:gtable]gtable object populated by the draw_panels() method. themeA [=complete_theme]complete theme object. Value The table object, optionally with different widths and heights properties. attach_axesDescription A function method that renders axis titles and adds them to the gtable. The default is to add one title at each side depending
Conventions
The object name that a new class is assigned to is typically the same as the class name. Facet class names are in UpperCamelCase and start with the Facet* prefix, like FacetNew. A constructor function is usually paired with a Facet class. The constructor copies the facet class and populates the params field. The constructor function name should take the Facet class name and be formatted with snake_case, so that FacetNew becomes facet_new().
Geom
Geoms
CRAN · 4.0.3 · data · ggplot2/man/Geom.Rd · 2026-05-07

All geom_*() functions (like geom_point()) return a layer that contains a Geom* object (like GeomPoint). The Geom* object is responsible for rendering the data in the plot.

Aliases
GeomGeomCustomAnnGeomLogticksGeomPolygonGeomMapGeomAnnotationMapGeomRasterGeomRasterAnnGeomAblineGeomRectGeomBarGeomTileGeomBin2dGeomBlankGeomBoxplotGeomColGeomPathGeomLineGeomStepGeomContourGeomContourFilledGeomPointGeomCrossbarGeomSegmentGeomCurveGeomRibbonGeomAreaGeomDensityGeomDensity2dGeomDensity2dFilledGeomDotplotGeomErrorbarGeomErrorbarhGeomFunctionGeomHexGeomHlineGeomLabelGeomLinerangeGeomPointrangeGeomQuantileGeomRugGeomSmoothGeomSpokeGeomTextGeomViolinGeomVline
Keywords
datasetsinternal
Concepts
Layer components
Details
Each of the Geom* objects is a [=ggproto]ggproto() object, descended from the top-level Geom, and each implements various methods and fields. The object and its parameters are chaperoned by the Layer class. Compared to Stat and Position, Geom is a little different because the execution of the setup and compute functions is split up. setup_data runs before position adjustments, and draw_layer() is not run until render time, much later. When creating a new Geom class, you may want to consider override one or more of the following: The required_aes and default_aes fields. The setup_data() and setup_params() functions. Either the draw_panel() or draw_group() function. The draw_key field.
Examples
# Extending the class GeomSimplePoint <- ggproto( "GeomSimplePoint", Geom, # Fields required_aes = c("x", "y"), draw_key = draw_key_point, # Methods draw_panel = function(data, panel_params, coord) data <- coord$transform(data, panel_params) grid::pointsGrob(data$x, data$y) ) # Building a constructor geom_simple_point <- function(mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) layer( mapping = mapping, data = data, geom = GeomSimplePoint, stat = stat, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list(na.rm = na.rm, ...) ) # Use new geom in plot ggplot(mpg, aes(displ, hwy)) + geom_simple_point()
See also
The https://ggplot2-book.org/extensions#sec-new-geomsnew geoms section of the online ggplot2 book. Run vignette("extending-ggplot2"), in particular the "Creating a new geom" section. Other Layer components: Layer-class, Position, Stat
Custom sections
Fields
required_aesA character vector naming aesthetics that are necessary to render the geom. non_missing_aesA character vector naming aesthetics that will cause removal if they have missing values. optional_aesA character vector naming aesthetics that will be accepted by layer(), but are not required or described in the default_aes field. default_aesA [=aes]mapping of default values for aesthetics. Aesthetics can be set to NULL to be included as optional aesthetic. rename_sizeA scalar boolean: whether to rename size aesthetics to linewidth. extra_paramsA character vector of parameter names in addition to those imputed from the draw_panel() or draw_groups() methods. This field can be set to include parameters for setup_data() or handle_na() methods. By default, this only contains "na.rm". draw_keyA function generating a single legend glyph for the geom. Typically one of the functions prefixed by [=draw_key]draw_key_. setup_paramsDescription A function method for modifying or checking the parameters based on the data. The default method returns the parameters unaltered. Usage html<div class="sourceCode r">Geom$setup_params(data, params) html</div> Arguments dataA data frame with the layer's data. paramsA list of current parameters. Value A list of parameters setup_dataDescription A function method for modifying or checking the data prior to adding defaults. The default method returns data unaltered. Usage html<div class="sourceCode r">Geom$setup_data(data, params) html</div> Arguments dataA data frame with the layer's data. paramsA list of parameters coming from the setup_params() method. Value A data frame with layer data use_defaultsDescription A function method for completing the layer data by filling in default aesthetics that are not present. It is not recommended to use as an extension point. It takes on these tasks: Evaluation of default aesthetics from the default_aes field. Handling the [=after_scale]after_scale()/stage(after_scale) stage of delayed evaluation. Fill in fixed, unmapped aesthetics passed as parameters. Usage html<div class="sourceCode r">Geom$use_defaults(data, params, modifiers, default_aes, theme, ...) html</div> Arguments dataA data frame of the layer's data, coming from the setup_data() method. Can be NULL, in which case resolved defaults should be returned. paramsA list of fixed aesthetic parameters modifiersA [=aes]mapping with delayed evaluations. default_aesA [=aes]mapping with default aesthetics. themeA [=complete_theme]completed theme. Value A data frame with completed layer data. handle_naDescription A function method to handle missing values. The default method will remove rows that have missing values for the aesthetics listed in the required_aes and non_missing_aes fields. It is not recommended to use this method as an extension point. Usage html<div class="sourceCode r">Geom$handle_na(data, params) html</div> Arguments dataA data frame with the layer's data coming from the update_defaults() method. paramsA list of parameters coming from the setup_params() method Value A data frame with layer data draw_layerDescription A function method orchestrating the drawing of the entire layer. The default method splits the data and passes on drawing tasks to the panel-level draw_panel() method. It is not recommended to use this method as an extension point. Usage html<div class="sourceCode r">Geom$draw_layer(data, params, layout, coord) html</div> Arguments dataA data frame with the layer's data. paramsA list of parameters layoutA completed <Layout> ggproto object. coordA <Coord> ggproto object. Value A list of grobs, one per panel draw_panel,draw_groupDescription A function method orchestrating the drawing of the layer for a single panel or group. The default draw_panel() method splits the data into groups, passes on the drawing tasks to the group-level draw_group() method and finally assembles these into a single grob. The default draw_group method is not implemented. Usage html<div class="sourceCode r">Geom$draw_panel(data, panel_params, coord, ...) Geom$draw_group(data, panel_params, coord, ...) html</div> Arguments dataA data frame with the layer's data. panel_paramsA list of per-panel parameters constructed by Coord$setup_panel_params(). This should be considered an opaque data structure that is just passed along when calling coord methods. coordA <Coord> ggproto object. To correctly scale the position data, one should always call coord$transform(data, panel_params). When working with non-linear coordinate systems, data should be converted to fit a primitive geom (e.g. point, path or polygon) and passed on to the corresponding draw method for [=coord_munch]munching. ...Reserved for extensions. By default, this is passed on to the draw_group() method. Value A single grob or [=zeroGrob]zeroGrob() when there is nothing to draw. For draw_panel() this can be a [grid:grid.grob]gTree holding individual grobs from the draw_group() method. parametersDescription A function method for listing out all acceptable parameters for this geom. Usage html<div class="sourceCode r">Geom$parameters(extra) html</div> Arguments extraA boolean: whether to include the extra_params field. Value A character vector of parameter names. aestheticsDescription A function method for listing out all acceptable aesthetics for this geom. Usage html<div class="sourceCode r">Geom$aesthetics() html</div> Value A character vector of aesthetic names.
Conventions
The object name that a new class is assigned to is typically the same as the class name. Geom class names are in UpperCamelCase and start with the Geom* prefix, like GeomNew. A constructor function is usually paired with a Geom class. The constructor wraps a call to layer(), where e.g. layer(geom = GeomNew). The constructor function name is formatted by taking the Geom class name and formatting it with snake_case, so that GeomNew becomes geom_new().
Guide
Guides
CRAN · 4.0.3 · data · ggplot2/man/Guide.Rd · 2026-05-07

The guide_* functions (like guide_legend()) return Guide* objects (like GuideLegend). The Guide* object is responsible for rendering the guide for at least one aesthetic.

Aliases
GuideGuideAxisGuideAxisLogticksGuideAxisStackGuideAxisThetaGuideLegendGuideBinsGuideColourbarGuideColourstepsGuideCustomGuideNoneGuideOld
Keywords
datasetsinternal
Details
Each of the Guide* objects is a [=ggproto]ggproto() object, descended from the top-level Guide, and each implements various methods and fields. Building a guide has three stages: The guide extracts the relevant information from scales. The guide interacts with other parts of the plot, like coords or layers to supplement information. The guide is rendered. When creating a new Guide class, you may want to consider overriding one or more of the following: The params, elements, hashables and available_aes fields. The extract_key(), extract_decor() and extract_params() methods. The transform() or get_layer_key() methods. The setup_params() and override_elements() methods. Any of the build_* methods. As a last resort the measure_grobs(), arrange_layout(), and assemble_drawing() methods.
Examples
# Extending the class GuideDescribe <- ggproto( "GuideDescribe", Guide, # Fields elements = list(text = "legend.text", margin = "legend.margin"), hashables = rlang::exprs(key$.label), # Methods build_title = function(...) zeroGrob(), # Turn off title build_labels = function(key, elements, params) labels <- key$.label n <- length(labels) labels <- paste0(paste0(labels[-n], collapse = ", "), ", and ", labels[n]) labels <- paste0("A guide showing ", labels, " categories") element_grob(elements$text, label = labels, margin_x = TRUE, margin_y = TRUE) , measure_grobs = function(grobs, params, elements) # Measuring in centimetres is the convention width <- grid::convertWidth(grid::grobWidth(grobs$labels), "cm", valueOnly = TRUE) height <- grid::convertHeight(grid::grobHeight(grobs$labels), "cm", valueOnly = TRUE) list(width = unit(width, "cm"), height = unit(height, "cm")) , assemble_drawing = function(self, grobs, layout, sizes, params, elements) gt <- gtable::as.gtable(grobs$labels, width = sizes$width, height = sizes$height) gt <- gtable::gtable_add_padding(gt, elements$margin) gt ) # Building a constructor guide_describe <- function(position = NULL) new_guide(position = position, super = GuideDescribe) # Use new guide plot ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point() + guides(colour = guide_describe("bottom"))
See also
Run vignette("extending-ggplot2"), in particular the "Creating new guides" section.
Custom sections
Fields
paramsA list of initial parameters that the guide needs to function. The base Guide$params contains mandatory parameters, but extensions can add new parameters. It has the following roles: It provides the default values for parameters. names(params) determines what are valid arguments for new_guide(). During build stages, a mutable copy of params holds information about the guide. available_aesA character vector of aesthetic names for which the guide is appropriate. Can use keyword "any" to indicate all non-position aesthetics. elementsA named list of strings stating which theme elements this guide uses. By default, strings will be translated in Guide$setup_elements() using calc_element(). Strings are expected to occur in names(get_element_tree()), like "legend.text" for example. Position guides typically append the \aes\.\position\ suffix in the setup_elements() method when the position is known. hashablesA list of calls or names constructed by rlang::exprs() indicating objects in the params field. These will be evaluated in the context of the params field and the resulting list will be hashed. The hash uniquely identify guides that can merge. Guides that have different hashes will not merge. For extensions, you should include objects that clearly mark two guides from one another that cannot be merged. trainDescription A function method for orchestrating the training of a guide, which extracts necessary information from a Scale object. As orchestrator, this method is not intended for extension. Usage html<div class="sourceCode r">Guide$train(params, scale, aesthetic, ...) html</div> Arguments paramsA list of parameters initiated by the params field. scaleA <Scale> ggproto object. In the case of position guides, can be a <ViewScale> ggproto object. aestheticA scalar string specifying the aesthetic. If missing (default), it will use the first aesthetic specified in the scale. ...Additional parameters passed on to the extract_params() method. Value A modified list of parameters extract_keyDescription A function method for extracting break information from the scale called the 'key'. It retrieves breaks, maps these breaks and derives labels. These form the basis for tick marks and labels in some guides. It is appropriate to override in extensions. Usage html<div class="sourceCode r">Guide$extract_key(scale, aesthetic, ...) html</div> Arguments scaleA <Scale> ggproto object. In the case of position guides, can be a <ViewScale> ggproto object. aestheticA scalar string specifying the aesthetic. ...Optional arguments from the params field. Value A 'key' data frame containing annotated scale breaks, including at least a column for the aesthetic, .label and .value. If there are no breaks, returns NULL. extract_decorDescription A function method for extracting 'decor' from the scale. The 'decor' acts as a wildcard for anything the guide may need to render that is not based on the key. For this reason, it has guide specific meaning that indicates different things for different guides. In guide_colourbar() it is the colour gradient, but in guide_axis() it is the axis line information. It is appropriate to override in extensions. Usage html<div class="sourceCode r">Guide$extract_decor(scale, aesthetic, ...) html</div> Arguments scaleA <Scale> ggproto object. In the case of position guides, can be a <ViewScale> ggproto object. aestheticA scalar string specifying the aesthetic. ...Optional arguments from the params field. Value Undefined. NULL by default. extract_paramsDescription A function method for extracting any other information from the scale that the guide may need. A typical example is to derive the title from the scale, or apply any edits to the key or decor variables. Usage html<div class="sourceCode r">Geom$extract_params(scale, params, ...) html</div> Arguments scaleA <Scale> ggproto object. In the case of position guides, can be a <ViewScale> ggproto object. paramsA list of parameters initiated by the params field, which at this point includes the key and decor from previous extractors. ...Additional arguments passed from the train() method. For non-position guides, often includes title as derived from the plot$labels field. Value A modified list of parameters transformDescription A function method to apply coord transformation and munching to the 'key' and 'decor' parameters. This method only applies to position guides like guide_axis() and is not called for non-position guides. It is recommended to override this method if you have a position guide that does not inherit from GuideAxis or has custom key' or 'decor' structures that GuideAxis$transform() does not handle well. Usage html<div class="sourceCode r">Guide$transform(params, coord, ...) html</div> Arguments paramsA list of parameters initiated by the params field. coordA <Coord> ggproto object. ...Optional arguments, typically panel_params for most position guides. Value A list of parameters. The default throws an error. mergeDescription A function method for combining information from two guides. When two guides have the same computed hash parameter derived from the hashables field, this function will be called to merge them. If more than two guides need to be merged, they are merged successively in a Reduce()-like fashion. Merging guides is the mechanism by which guide_legend() can take one guide trained on the shape scale, another trained on the colour scale and display them together in the same guide, for example. Overriding this method is recommended if the extension descends directly from Guide and not its children. Otherwise, it should be overridden if presented with no superior options. Usage html<div class="sourceCode r">Guide$merge(params, new_guide, new_params) html</div> Arguments paramsA list of parameters derived from the params field of this guide. new_guideA <Guide> ggproto object representing the other guide class new_paramsA list of parameters derived from the params field of the other guide Value A named list containing guide and params, where guide is a <Guide> ggproto object and params is a list with parameters. By default, returns the new guide and its parameters. process_layers,get_layer_keyDescription These function methods extract information from layers that the guide may need. The process_layers() method is tasked with selecting layers that are represented by the guide and are to be included. The selected layers should be passed on to the get_layer_key() method. Typical use of these methods is for guide_legend() to extract the Geom$draw_key function to render glyphs in addition to any default or fixed aesthetics. While these methods are called in position guides, the layers and data arguments are empty as these are unavailable at that point. You can override get_layer_key(), but process_layers() should probably only be overridden if the extension does not inherit from GuideLegend. Usage html<div class="sourceCode r">Guide$process_layers(params, layers, data, theme) Guide$get_layer_key(params, layers, data, theme) html</div> Arguments paramsA list of parameters initiated by the params field. layersA list of layers from plot$layers. dataA list of layer data frames. themeA [=complete_theme]completed theme object. Value A list of parameters drawDescription A function method is the main orchestrator for drawing the guide. It sets up the final pieces in context of the position, direction and theme and. Subsequenty, it renders the individual components like titles, ticks, labels and decor. Finally, it arranges these components into a guide. This method should only be overridden if the extension has non standard components that do not fit into 'decor' or when this method can be greatly simplified for humble guides. All subsidiaries are fine to override. Usage html<div class="sourceCode r">Geom$setup_params(theme, position, direction, params) html</div> Arguments themeA [=complete_theme]complete theme object. positionA scalar string indicating the position where the guide should be drawn. Typically "top", "right", "bottom" or "left", unless it is a position guide for an exotic coord. Can be NULL, in which case params$position should be used. directionA scalar string indicating the legend direction. Can be NULL, in which case params$direction should be used. paramsA list of parameters initiated by the params field. Value A grob with the guide. draw_early_exitDescription A function method that determines what should be drawn when the guide 'key' is empty. The default method returns [=zeroGrob]zeroGrob(). You can override this method if an empty key should draw anything. Used in guide_axis() to render the axis.line part even if no ticks or labels should be drawn. Usage html<div class="sourceCode r">Guide$draw_early_exit(params, elements) html</div> Arguments paramsA list of parameters initiated by the params field. elementsA list of elements or resolved theme settings from the override_elements() method. Value A grob. setup_paramsDescription A function method for finalising parameters. Typically used to make checks on the params object or to make any position or direction based adjustments. Usage html<div class="sourceCode r">Guide$setup_params(params) html</div> Arguments paramsA list of parameters initiated by the params field. Value A list of parameters setup_elements,override_elementsDescription A function method for resolving required theme elements. The setup_elements() method joins local guide theme with global theme and calculates the necessary theme elements. The override_elements() method is a hook to edit elements after they've been calculated. You can override the setup_elements() method if you need more complicated theme handling before calculating elements or want to intervene in inheritance. For example, guide_legend() has special handling of text margins and guide_axis() suffixes \aes\.\position\ to get the theme elements for the correct position. For other purposes, you can override the override_elements() method. Usage html<div class="sourceCode r">Guide$setup_elements(params, elements, theme) Guide$override_elements(params, elements, theme) html</div> Arguments paramsA list of parameters initiated by the params field. elementsA named list of strings initiated by the elements field. themeA [=complete_theme]complete theme Value A list of elements or resolved theme settings. build_titleDescription A function method for rendering the title. Note that titles for position guides are rendered by the Facet class and not this method. You can override this method if you need to render more than one title (or none) or adjust margin settings. Usage html<div class="sourceCode r">Guide$build_title(label, elements, params) html</div> Arguments labelA single string or expression with the title text. elementsA list of elements or resolved theme settings from the override_elements() method. The default method expects elements$title to inherit from the <element_text> class. paramsA list of parameters initiated by the params field. Value A grob representing the title. build_ticksDescription A function method for rendering tick marks. You can override this function if you don't need ticks or have completely different logic on how these should be drawn. Usage html<div class="sourceCode r">Guide$build_ticks(key, elements, params, position, length) html</div> Arguments keyA data frame with the key information derived from the extract_key() method. elementsA list of elements or resolved theme settings from the override_elements() method. The default method expects elements$ticks to inherit from the <element_line> class and elements$ticks_length to be a scalar <unit> object. paramsA list of parameters initiated by the params field. positionA scalar string indicating the position. Due to historic error this works in the opposite way to intuition: if you want ticks for an axis at the bottom of a plot, you should use "top" here. lengthA scalar <unit> object giving the tick length. Value A grob representing t
Conventions
The object name that a new class is assigned to is typically the same as the class name. Guide class names are in UpperCamelCase and start with the Guide* prefix, like GuideNew. A constructor function is usually paired with a Guide class. The constructor wraps a call to new_guide(), where e.g. new_guide(super = GuideNew). The constructor name is formatted by taking the Guide class name and formatting it with snake_case, so that GuideNew becomes guide_new().
Layer-class
Layers
CRAN · 4.0.3 · data · ggplot2/man/Layer-class.Rd · 2026-05-07

The Layer class is a chaperone class not available for extension. The class fulfils the following tasks. The class houses the Geom, Stat and Position trinity and tracks their stateful parameters. Furthermore, its methods are responsible for managing the layer data and exposing it to other components of the plot at the right time.

Aliases
Layer-classLayer
Keywords
internal
Concepts
Layer componentschaperone classes
Details
The Layer class is an internal class that is not exported because the class is not intended for extension. The layer() function instantiates the LayerInstance class, which inherits from Layer, but has relevant fields populated. The class is mostly used in ggplot_build(), with the notable exception of the draw_geom() method, which is used in ggplot_gtable() instead.
Examples
# None: Layer is not intended to be extended
See also
Other Layer components: Geom, Position, Stat Other chaperone classes: Layout
Custom sections
Fields
constructorA [=call]call object with the user-facing constructor function, for use in error messaging. This field is populated by layer(). geom,stat,positionThese fields house the Geom, Stat and Position trifecta in ggproto form and is populated by layer(). stat_params,computed_stat_paramsThese fields hold parameters assigned to the Stat. The stat_params field is directly derived from user input and is populated by layer(). The computed_stat_params carries state and is constructed by the Stat$setup_params() method. geom_params,computed_geom_paramsThese fields hold parameters assigned to the Geom. The geom_params field is directly derived from user input and is populated by layer(). The computed_geom_params carries state and is constructed by the Geom$setup_params() method. mapping,computed_mappingThese fields hold [=aes]mappings. The mapping field holds the layer(mapping) argument. The computed_mapping field carries state and is constructed in the setup_layer() method. dataThe fortified layer(data) argument. aes_paramsHolds the fixed, unmapped aesthetics passed to layer(params) as determined by Geom$aesthetics(). inherit.aesA scalar boolean used in the setup_layer() method to indicate whether the computed_mapping should include the global mapping (TRUE) or only the layer mapping (FALSE). This is populated by the layer(inherit.aes) parameter. layer_dataDescription A function method for initially resolving layer data. If layer data is missing or is a function, it will derive layer data from the global plot data. Usage html<div class="sourceCode r">Layer$layer_data(plot_data) html</div> Arguments plot_dataThe data field of the ggplot object. Value A data frame with layer data or NULL setup_layerDescription A function method is a hook to allow a final access to layer data in input form. In addition, it allows a layer access to global plot information. The latter is used to enforce the inherit.aes parameter by supplementing the layer mapping with the global mapping when requested. Usage html<div class="sourceCode r">Layer$setup_data(data, plot) html</div> Arguments dataA data frame with the layer's data. plotA ggplot object Value A data frame with layer data. As a side effect, the computed_mapping field is populated. compute_aestheticsDescription A function method that evaluates aesthetics and warns about any problems. It also infers a group aesthetic if not provided. This method is also the step where layer data becomes standardised to base data frames without row names or additional attributes. Usage html<div class="sourceCode r">Layer$compute_aesthetics(data, plot) html</div> Arguments dataA data frame with the layer's data. plotA ggplot object Value A data frame with layer data compute_aestheticsDescription A function method that orchestrates computing statistics. It executes methods from the Stat class to form new computed variables. Usage html<div class="sourceCode r">Layer$compute_statistic(data, layout) html</div> Arguments dataA data frame with the layer's data. layoutA <Layout> ggproto object. Value A data frame with layer data. As a side effect the computed_stat_params field is populated. map_statisticDescription A function method that finishes the result of computed statistics. It has several tasks: It evaluates the after_stat() stage of the mapping from both the computed_mapping but also the Stat$default_aes fields. It ensures relevant scales are instantiated for computed aesthetics. It takes care that scale transformation is applied to computed aesthetics. Usage html<div class="sourceCode r">Layer$map_statistic(data, plot) html</div> Arguments dataA data frame with the layer's data. plotA ggplot object. Value A data frame with layer data compute_geom_1Description A function method that prepares data for drawing. It checks that all required aesthetics are present and sets up parameters and data using the Geom class. Usage html<div class="sourceCode r">Layer$compute_geom_1(data) html</div> Arguments dataA data frame with the layer's data. Value A data frame with layer data. As a side effect the computed_geom_params field is populated. compute_positionDescription A function method that orchestrates the position adjustment. It executes methods from the Position class. Usage html<div class="sourceCode r">Layer$compute_position(data, layout) html</div> Arguments dataA data frame with the layer's data. layoutA <Layout> ggproto object. Value A data frame with layer data. compute_geom_2Description A function method that add defaults and fixed parameters. It wraps the Geom$use_defaults() method. Usage html<div class="sourceCode r">Layer$compute_geom_2(data, params, theme, ...) html</div> Arguments dataA data frame with the layer's data. paramsA list with fixed aesthetic parameters, typically the aes_params field. themeA [=theme]theme object ...Passed on to Geom$use_defaults(), not in use. Value A data frame with layer data. finish_statisticsDescription A function method that wraps Stat$finish_layer(). Usage html<div class="sourceCode r">Layer$finish_statistics(data) html</div> Arguments dataA data frame with the layer's data. Value A data frame with layer data. draw_geomDescription A function method that produces graphics for every panel. It uses Geom class methods to handle missing data and produce grobs. In contrast to other methods, this is called during the ggplot_gtable() stage, not the ggplot_build() stage. Usage html<div class="sourceCode r">Layer$draw_geom(data, layout) html</div> Arguments dataA data frame with the layer's data. layoutA <Layout> ggproto object. Value A list of grobs, one per panel. printDescription A function method that prints information about the layer. Usage html<div class="sourceCode r">Layer$print() html</div> Value Nothing (NULL), invisibly
Layer data diagram
As the Layer class is a chaparone for the data, it makes sense to give a small overview of how layer data flows through a plot. In the diagram below we following the layer(data) argument over the course of plot building through Layer class methods. When an outside class acts on the data without the Layer class, this is indicated with the left arrow <-. Subcomponents of a method that touch data are indicated with the right arrow ->. html<div class="sourceCode r"># Inside `ggplot_build()` | layer(data) | | | # Inherit plot data | Layer$layer_data() | | | # Finalise mapping | Layer$setup_layer() | | | # Append PANEL variable for facets | |<- Layout$setup() | | | +-> Facet$setup_data() | | | +-> Coord$setup_data() | | | # Evaluate mappings to new data and infer group | Layer$compute_aesthetics() | | | # Scale-transform all aesthetics | |<- ScalesList$transform_df() | | | +-> Scale$transform_df() | | | # Map x/y aesthetics with initial scale | |<- Layout$map_position() | | | +-> Scale$map() | | | # Compute stat part of layer | Layer$compute_statistic() | | | +-> Stat$setup_data() | | | +-> Stat$compute_layer() | | | # Add `after_stat()` stage | # Scale transform computed variables | Layer$map_statistic() | | | # Setup geom part of layer | Layer$compute_geom_1() | | | +-> Geom$setup_data() | | | # Apply position adjustments | Layer$compute_position() | | | +-> Position$use_defaults() | | | +-> Position$setup_data() | | | +-> Position$compute_layer() | | | # Map x/y aesthetics with final scales | |<- Layout$map_position() | | | +-> Scale$map() | | # Map non-position aesthetics | |<- ScalesList$map_df() | | | +-> Scale$map() | | | # Fill in defaults and fixed aesthetics | Layer$compute_geom_2() | | | +-> Geom$use_defaults() | | | # Apply final Stat hook | Layer$finish_statistics() | | | +-> Stat$finish_layer() | | | # Apply final Facet hook | |<- Layout$finish_data() | | | +-> Facet$finish_data() | V # `ggplot_build()` is finished # Hand off to `ggplot_gtable()` | | | # Draw the geom part | Layer$draw_geom() | +-> Geom$handle_na() | +-> Geom$draw_layer() html</div>
Layout
CRAN · 4.0.3 · data · ggplot2/man/Layout.Rd · 2026-05-07

The Layout class is a chaperone class discouraged for extension. The class fulfils the following tasks. The class houses the Coord and Facet classes and tracks their stateful parameters. In addition, it manages the position scales for each panel. It is responsible for keeping track of panel specifications and matching pieces of the data to scales and parameters in panel-wise manners.

Aliases
Layout
Keywords
internal
Concepts
Layout componentschaperone classes
Details
The Layout class is only exported for extensions that re-implement a ggplot_build() method for their specific class of plots. It is discouraged to subclass the Layout class and for all purposes be considered an internal structure. It has no user-facing constructor to put an small barrier in the way. The class is used throughout ggplot_build(), with the notable exception of the render() method, which is used in ggplot_gtable() instead.
Examples
# Some dummy layout components facet <- facet_null() coord <- coord_cartesian() # Use in custom `ggplot_build()` methods layout <- ggproto(NULL, Layout, facet = facet, coord = coord)
See also
Other Layout components: Coord, Facet Other chaperone classes: Layer-class
Custom sections
Fields
coord,coord_paramsA [=Coord]<Coord> ggproto object and a list of the coordinate system's parameters. Parameters get populated by the Coord$setup_params() method. facet,facet_paramsA [=Facet]<Facet> ggproto object and a list of the faceting specification's parameters. Parameters get populated by the Facet$setup_params() method. layoutA data frame with a row for each panel. The data frame contains integer columns PANEL, SCALE_X, SCALE_Y, ROW and COL representing a panel ID, scale indices and placement locations. In addition, the layout may contain faceting variables or other additional information. This field gets populated by the Facet$compute_layout() method. panel_scales_x,panel_scales_yA list of x and y position scales parallel to the layout field's SCALE_X and SCALE_Y levels respectively. This fields gets populated by the Facet$init_scales() method. panel_paramsA named list of parameters per panel populated by the Coord$setup_panel_params() method. Contains <ViewScale> entries for the x and y variables in addition to ranges and other information the coordinate system might need to transform or render guides and grids. setupDescription A function method for setting up the relevant information for the layout of the plot. It populates the facet_params, coord_params and layout fields and appends a PANEL variable to the layer data. Usage html<div class="sourceCode r">Layout$setup(data, plot_data, plot_env) html</div> Arguments dataA list of data frames with layer data. plot_dataThe data frame in the data field of the ggplot object. plot_envThe environment in the plot_env field of the ggplot object. Value A list of data frames from the data argument with a PANEL variable corresponding to rows in the layout field. Also called for the side effects of populating fields. train_positionDescription A function method for training position scales and optionally initiating them. Implementation is via the Facet$train_scales() and Facet$init_scales() methods. Usage html<div class="sourceCode r">Layout$train_position(data, x_scale, y_scale) html</div> Arguments dataA list of data frames with layer data. x_scale,y_scaleA single prototype position scale for the x and y aesthetics respectively. Value Nothing, this method is called for the side effect of training scales and optionally populating the panel_scales_x and panel_scales_y fields. map_positionDescription A function method for mapping position aesthetics. For discrete scales this converts discrete levels to a numeric representation, usually integers. For continuous scales, this applies out-of-bounds handling. Usage html<div class="sourceCode r">Layout$map_position(data) html</div> Arguments dataA list of data frames with layer data. Value A list of data frames per the data argument with mapped position aesthetics. reset_scalesDescription A function method for resetting scale ranges. After computing stats and position adjustments, scales need to be reset and re-trained to have an accurate measure of the data limits. This goes through the panel_scales_x and panel_scales_y fields and invokes the Scale$reset() method. Usage html<div class="sourceCode r">Layout$reset_scales() html</div> Value Nothing, it is called for the side-effect of resetting scale ranges. setup_panel_paramsDescription A function method for executing Coord$setup_panel_params() once per panel with the appropriate scales. For efficiency reasons, the setup is invoked once per unique combination of x and y scale. Usage html<div class="sourceCode r">Layout$setup_panel_params() html</div> Value Nothing, it is called for the side effect of populating the panel_params field. setup_panel_guidesDescription A function method for setting up and training the position guides (axes) once per panel with the appropriate scales. For efficiency reasons, the guides are setup once per unique combination of x and y scale. It calls the Coord$setup_panel_guides() and Coord$train_panel_guides() methods. Usage html<div class="sourceCode r">Layout$setup_panel_guides(guides, layers) html</div> Arguments guidesA <Guides> ggproto object from the guides field of the ggplot object. layersA list of layers from the layers field of the ggplot object. Value Nothing, it is called for the side effect of augmenting each entry of the panel_params field with position guides. setup_panel_guidesDescription A function method for setting up the Facet$finish_data() hook. Usage html<div class="sourceCode r">Layout$finish_data(data) html</div> Arguments dataA list of data frames with layer data. Value A list of data frames with layer data. renderDescription A function method for drawing and assembling the core plot. Mostly it delegates tasks to the specific Facet methods for drawing components. Usage html<div class="sourceCode r">Layout$render(panels, data, theme, labels) html</div> Arguments panelsA list parallel to layers. Each element is another list with grobs for each panel, generated by Layer$draw_geom(). dataA list of data frames with layer data. themeA [=complete_theme]complete theme. labelsA list of labels from the labels field of the ggplot object. Value A gtable containing a plot with panels, axes, axis titles and strips. resolve_labelDescription A function method for prying the axis titles from guides, scales or plot labels. Usage html<div class="sourceCode r">Layout$resolve_label(scale, labels) html</div> Arguments scaleA single scale from the panel_scales_x or panel_scales_y fields. labelsA list of labels from the labels field of the ggplot object. Value A named list containing a two titles named "primary" and "secondary". render_labelsDescription A function method for drawing axis title grobs. The position guides themselves do not typically render the axis title grobs as they are orchestrated by the layout to draw one title even for multiple axes. Usage html<div class="sourceCode r">Layout$render_labels(labels, theme) html</div> Arguments labelsA named list containing an x list and a y list. The x and y lists have primary and secondary labels. It originates from the Coord$labels() method. themeA [=complete_theme]complete theme. Value A list with the same structure and names as the labels argument, but with grobs instead of text. get_scalesDescription A function method for retrieving panel specific scales. It is called in the Stat$compute_layer() and Position$compute_layer() methods. The Geom uses the panel_params field instead of the raw scales. Usage html<div class="sourceCode r">Layout$get_scales(i) html</div> Arguments iA scalar integer panel index giving the panel for which to retrieve scales Value A named list of scales giving the x and y scale for the panel.
Position
Positions
CRAN · 4.0.3 · data · ggplot2/man/Position.Rd · 2026-05-07

All position_*() functions (like position_dodge()) return a Position* object (like PositionDodge). The Position* object is responsible for adjusting the position of overlapping geoms.

Aliases
PositionPositionDodgePositionDodge2PositionIdentityPositionJitterPositionJitterdodgePositionNudgePositionStackPositionFill
Keywords
datasetsinternal
Concepts
Layer components
Details
The way that the position_* functions work is slightly different from the geom_* and stat_* functions, because a position_* function actually "instantiates" the Position* object by creating a descendant, and returns that. The object is chaperoned by the Layer class. To create a new type of Position object, you typically will want to override one or more of the following: The required_aes and default_aes fields. The setup_params() and setup_data() methods. One of the compute_layer() or compute_panel() methods.
Examples
# Extending the class PositionRank <- ggproto( "PositionRank", Position, # Fields required_aes = c("x", "y"), # Methods setup_params = function(self, data) list(width = self$width), compute_panel = function(data, params, scales) width <- params$width if (is.null(width)) width <- resolution(data$x, zero = FALSE, TRUE) * 0.4 rank <- stats::ave(data$y, data$group, FUN = rank) rank <- scales::rescale(rank, to = c(-width, width) / 2) data$x <- data$x + rank data ) # Building a constructor position_rank <- function(width = NULL) ggproto(NULL, PositionRank, width = width) # Use new position in plot ggplot(mpg, aes(drv, displ)) + geom_point(position = position_rank(width = 0.5))
See also
The https://ggplot2-book.org/extensions#new-positionsnew positions section of the online ggplot2 book. Other Layer components: Geom, Layer-class, Stat
Custom sections
Fields
required_aesA character vector naming aesthetics that are necessary to compute the position adjustment. default_aesA [=aes]mapping of default values for aesthetics. use_defaultsDescription A function method for completing the layer data by filling in default position aesthetics that are not present. These can come from two sources: either from the layer parameters as static, unmapped aesthetics or from the default_aes field. Usage html<div class="sourceCode r">Position$use_defaults(data, params) html</div> Arguments dataA data frame of the layer's data paramsA list of fixed aesthetic parameters Value A data frame with completed layer data setup_paramsDescription A function method for modifying or checking the parameters based on the data. The default method returns an empty list. Usage html<div class="sourceCode r">Position$setup_params(data) html</div> Arguments dataA data frame with the layer's data. Value A list of parameters setup_dataDescription A function method for modifying or checking the data. The default method checks for the presence of required aesthetics. Usage html<div class="sourceCode r">Position$setup_data(data, params) html</div> Arguments dataA data frame with the layer's data. paramsA list of parameters coming from the setup_params() method Value A data frame with layer data compute_layerDescription A function method orchestrating the position adjust of the entire layer. The default method splits the data and passes on adjustment tasks to the panel-level compute_panel(). In addition, it finds the correct scales in the layout object to pass to the panel computation. Usage html<div class="sourceCode r">Position$compute_layer(data, params, layout) html</div> Arguments dataA data frame with the layer's data. paramsA list of parameters coming from the setup_params() method layoutA <Layout> ggproto object. Value A data frame with layer data compute_panelDescription A function method executing the position adjustment at the panel level. The default method is not implemented. Usage html<div class="sourceCode r">Position$compute_panel(data, params, scales) html</div> Arguments dataA data frame with the layer's data. paramsA list of parameters coming from the setup_params() method scalesA list of pre-trained x and y scales. Note that the position scales are not finalised at this point and reflect the initial data range before computing stats. Value A data frame with layer data aestheticsDescription A function method for listing out custom position aesthetics for this position adjustment. Usage html<div class="sourceCode r">Position$aesthetics() html</div> Value A character vector of aesthetic names.
Convention
The object name that a new class is assigned to is typically the same as the class name. Position class name are in UpperCamelCase and start with the Position* prefix, like PositionNew. A constructor functions is usually paired with a Position class. The constructor copies the position class and populates parameters. The constructor function name is formatted by taking the Position class name and formatting it with snake_case, so that PositionNew becomes position_new().
Scale
Scales
CRAN · 4.0.3 · data · ggplot2/man/Scale.Rd · 2026-05-07

All scale_*() functions (like scale_fill_continuous()) return a Scale* object. The main purpose of these objects is to translate data values to aesthetic values and populating breaks and labels.

Aliases
ScaleScaleContinuousScaleDiscreteScaleBinnedScaleBinnedPositionScaleContinuousPositionScaleContinuousDatetimeScaleContinuousDateScaleDiscretePositionScaleDiscreteIdentityScaleContinuousIdentity
Keywords
datasetsinternal
Details
All scale_* functions like [=scale_x_continuous]scale_x_continuous() return a Scale* object like ScaleContinuous. Each of the Scale* objects is a [=ggproto]ggproto() object descended from the top-level Scale. Scales generally need to track three types of spaces: Data space. These are values as they are evaluated from the plot or layer mapping, prior to any transformation. Transformed space. This is the space after original data has been transformed. Effectively, scales internally operate in transformed space in that ranges and breaks get passed around in this space. Discrete scales don't do transformations, so for these scales, transformed space is the same as untransformed space. Aesthetic space. Graphic values that are mapped from the transformed space. This is dependent on the palette field for most scales and on the rescaler field for continuous position scales. The user is expected to give any vector-based minor_breaks, breaks or limits in data space. When breaks, limits or labels is a function, its input is expected to be in data space. Before you attempt to create a new Scale* class of your own, it is recommended to think through whether your aims cannot be implemented with one of the existing classes. Making a wrapper for the continuous_scale(), discrete_scale() and binned_scale() should cover many cases, and should be considered prior to commiting to build a Scale* extension. For example, if you aim to develop a scale for a new data type, it should generally be possible to create a new [scales:new_transform]transformation instead. One reason to implement your own Scale* class is to accommodate a data type does not lend itself for continuous or discrete range training. In such case, you can override the following: The range field. The transform, train and map methods. The get_limits(), get_breaks() and get_labels() methods.
Examples
# TODO: find easy to digest example NULL
Custom sections
Fields
callA [=call]call object with the user-facing constructor function, for use in error messaging. This field is populated by scale constructors. rangeA [scales:Range]Range class object, like scales::ContinuousRange or scales::DiscreteRange. These are 'trained' to keep track of the data range (continuous) or data levels (discrete). Continuous ranges are tracked in transformed space. aesthetics,palette,name,breaks,labels,limits,name,guide,position,na.value,expandFields populated by the scale constructor that can take on the same values as described in e.g. [=continuous_scale]?continuous_scale. Note that limits is expected in transformed space. transform_df,transformDescription A function method for orchestrating the transformation of aesthetics in a data frame. Data transformation occurs before stats are computed. The transform_df() method ensures the transform() method is applied to the correct columns. Usage html<div class="sourceCode r">Scale$transform_df(df) Scale$transform(x) html</div> Arguments dfA data frame with the layer's data. xA vector of the relevant aesthetic. Value For transform() a vector of transformed values. For transform_df(), a named list with transformed values for each transformed aesthetic. train_df,trainDescription A function method for orchestrating scale training for keeping track of the data range or levels. The train_df() method ensures the train() method is applied to the correct columns. Usage html<div class="sourceCode r">Scale$train_df(df) Scale$train(x) html</div> Arguments dfA data frame with the layer's data. xA vector of the relevant aesthetic. Value Nothing, these are called for their side effect of updating the range field. map_df,mapDescription A function method for orchestrating the mapping of data values to aesthetics. The map_df() method ensures the map() method is applied to the correct columns. When the scale uses a palette() function, it is applied in the map() method. Usage html<div class="sourceCode r">Scale$map_df(df, i) Scale$map(x, limits) html</div> Arguments dfA data frame with the layer's data. iAn integer vector giving an index to map a subset of data. The default, NULL, will map all rows. xA vector of the relevant aesthetic. limitsA vector of the relevant aesthetic, usually via the get_limits() method. Value For map() a vector of mapped values in aesthetics space. For map_df(), a named list with mapped values for each aesthetic. recaleDescription A function method for applying the recale function in the rescaler field. It is used during the continuous map() and Coord$transform() methods to ensure values are in the 0-1 range. Usage html<div class="sourceCode r">Scale$rescale(x, limits, range) html</div> Arguments xA vector of values to rescale. Can contain out-of-bounds or missing values depending on the map() method. limitsA length two vector giving the limits of the relevant aesthetic, usually via the get_limits() method. rangeA length two vector giving the range that should coincide with the 0-1 points. For most purpuses, this should be the same as the limits argument. Value A vector of values between 0 and 1 for in-bounds values of x. get_limitsDescription A function method for resolving user input and getting the scale limits. Usage html<div class="sourceCode r">Scale$get_limits() html</div> Value The scale limits, without any expansion applied, in transformed space. dimensionDescription A function method for getting a continuous representation of the limits of position scales. For continuous scales, the dimension is the same concept as the limits. For discrete scales the dimension is the continuous range occupied by the mapped breaks, which by default take integer positions. Usage html<div class="sourceCode r">Scale$dimension(expand, limits) html</div> Arguments expandA length 4 vector giving scale [=expansion]expansion. This is optional and defaults to no expansion. limitsA vector of the relevant aesthetic, usually via the get_limits() method. Value A numeric vector of length 2 get_breaks,get_breaks_minorDescription A function method for resolving user input and getting the scale breaks or minor breaks. Note that these may return out-of-bounds values for the purpose of coordinating with the get_labels() method. Usage html<div class="sourceCode r">Scale$get_breaks(limits) Scale$get_breaks_minor(n, b, limits) html</div> Arguments limitsA vector of the relevant aesthetic, usually via the get_limits() method. nAn integer setting the desired number of minor breaks per major break. Note that the resulting minor breaks may coincide with major breaks. bA vector of mapped major breaks from the get_breaks() method. Value A vector of breaks in transformed space. get_labelsDescription A function method for resolving user input and getting the scale labels for a set of breaks. Usage html<div class="sourceCode r">Scale$get_labels(breaks) html</div> Arguments breaksA vector of unmapped major breaks from the get_breaks() method, in transformed space. Value A vector of labels of the same length as breaks. get_transformationDescription A helper method to access the scale's transformation object. Usage html<div class="sourceCode r">Scale$get_transformation() html</div> Value A [scales:new_transform]transform object. break_infoDescription A function method for getting all break related information for position scales. It is in use by coords that do not use the modern Guide system and secondary axes. Usage html<div class="sourceCode r">Scale$break_info(range) html</div> Arguments rangeA vector of the relevant aesthetic. Value A named list with the following structure: range a length 2 vector giving continuous range labels a character or expression vector of the same length as major breaks. major a numeric vector with mapped numeric values for major breaks. major_source a numeric vector with (transformed) data values for major breaks. minor a numeric vector with mapped numeric values for minor breaks. minor_source a numeric vector with (transformed) data values for minor breaks. break_positionDescription A function method for getting mapped break positions. It is in use as a default value in get_breaks_minor(), but is otherwise vestigial. Usage html<div class="sourceCode r">Scale$break_info(range) html</div> Arguments rangeA vector of the relevant aesthetic. Value A vector with mapped break positions make_title,make_sec_titleDescription A function method for picking the title to use. This is usually called in the Guide$extract_params() or Layout$resolve_label() methods. The hierarchy of titles goes from guide (highest priority), to scale, to labs (lowest priority). When the guide or scale title are functions, they're applied to the next in line. The make_sec_title() method by default re-uses the primary make_title() method and only applies to position aesthetics. Usage html<div class="sourceCode r">Scale$make_title(guide_title, scale_title, label_title) Scale$make_sec_title(...) html</div> Arguments guide_titleThe title parameter coming from a guide. scale_titleThe name field of the Scale. label_titleThe relevant entry in the plot$labels field. ...By default, arguments forwarded to the make_title() method Value A scalar character or expression title axis_orderDescription A function method for setting the order of axes titles used to coordinate with Facet$draw_labels(). Usage html<div class="sourceCode r">Scale$axis_order() html</div> Value Either c("primary", "secondary") or c("secondary", "primary"). cloneDescription A function method for making an untrained copy of the scale. Due to reference semantics of ggproto objects, in contrast to copy-on-modify semantics, scales need to be cloned at the start of plot building. The cloned scale can be trained independently of the original. Usage html<div class="sourceCode r">Scale$clone() html</div> Value A Scale object. resetDescription A function method for to reset the range field, effectively 'untraining' the scale. This is used in the Layout$reset_scales() method, so that scales can be re-trained on data with final position aesthetics. For discrete scales, only the continuous range (range_c) is reset. Usage html<div class="sourceCode r">Scale$clone() html</div> Value None, called for the side-effect of resetting the range. is_emptyDescription A function method for determining whether a scale is empty, i.e. when no information with which to calculate limits. Usage html<div class="sourceCode r">Scale$is_empty() html</div> Value A scalar boolean value. is_emptyDescription A function method for determining whether a scale is discrete. Usage html<div class="sourceCode r">Scale$is_discrete() html</div> Value A scalar boolean value.
Conventions
The object name that a new class is assigned to is typically the same as the class name. Scale class names are in UpperCamelCase and start with the Scale* prefix, like ScaleNew. In scales, there is a difference between user-facing and developer-facing constructors. Developer facing constructors have the shape \foundation\_scale(), like discrete_scale() corresponding to ScaleDiscrete. User-facing constructors have the scale_\aesthetic\_\type\ as name. If you implement a new Scale* class, you like want both these types of constructor.
Stat
Stats
CRAN · 4.0.3 · data · ggplot2/man/Stat.Rd · 2026-05-07

All stat_*() functions (like stat_bin()) return a layer that contains a Stat* object (like StatBin). The Stat* object is responsible for rendering the data in the plot.

Aliases
StatStatAlignStatBinStatSummary2dStatBin2dStatBindotStatBinhexStatBoxplotStatConnectStatContourStatContourFilledStatCountStatDensity2dStatDensity2dFilledStatDensityStatEcdfStatEllipseStatFunctionStatIdentityStatManualStatQqLineStatQqStatQuantileStatSmoothStatSumStatSummaryBinStatSummaryHexStatSummaryStatUniqueStatYdensity
Keywords
datasetsinternal
Concepts
Layer components
Details
Each of the Stat* objects is a [=ggproto]ggproto() object, descended from the top-level Stat, and each implements various methods and fields. The object and its parameters are chaperoned by the Layer class. To create a new type of Stat object, you typically will want to override one or more of the following: The required_aes and default_aes fields. One of the compute_layer(), compute_panel() or compute_group() functions. Typically it best to implement compute_group() and use the higher-up methods when there are substantial performance improvements to be gained. The finish_layer() method
Examples
# Extending the class StatKmeans <- ggproto( "StatKmeans", Stat, # Fields required_aes = c("x", "y"), # You can relate computed variables to aesthetics using `after_stat()` # in defaults default_aes = aes(colour = after_stat(cluster)), # Methods compute_panel = function(data, scales, k = 2L) km <- kmeans(cbind(scale(data$x), scale(data$y)), centers = k) data$cluster <- factor(km$cluster) data ) # Building a constructor stat_kmeans <- function(mapping = NULL, data = NULL, geom = "point", position = "identity", ..., k = 2L, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) layer( mapping = mapping, data = data, geom = geom, stat = StatKmeans, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list(na.rm = na.rm, k = k, ...) ) # Use new stat in plot ggplot(mpg, aes(displ, hwy)) + stat_kmeans(k = 3)
See also
The https://ggplot2-book.org/extensions#sec-new-statsnew stats section of the online ggplot2 book.. Run vignette("extending-ggplot2"), in particular the "Creating a new stat" section. Other Layer components: Geom, Layer-class, Position
Custom sections
Fields
required_aesA character vector naming aesthetics that are necessary to compute the stat. non_missing_aesA character vector naming aesthetics that will cause removal if they have missing values. optional_aesA character vector naming aesthetics that will be accepted by layer(), but are not required or dscribed in the default_aes field. default_aesA [=aes]mapping of default values for aesthetics. Aesthetics can be set to NULL to be included as optional aesthetic. dropped_aesA character vector naming aesthetics that can be dropped from the data without warning. Typically used for aesthetics that are 'consumed' during computation like "weight". extra_paramsA character vector of parameter names in addition to those imputed from the compute_panel() or compute_groups() methods. This field can be set to include parameters for setup_data() methods. By default, this only contains "na.rm". retransformA scalar boolean: should the values produced by the statistic also be transformed in the second pass when recently added statistics are trained to the scales setup_paramsDescription A function method for modifying or checking the parameters based on the data. The default method returns the parameters unaltered. Usage html<div class="sourceCode r">Stat$setup_params(data, params) html</div> Arguments dataA data frame with the layer's data. paramsA list of current parameters Value A list of parameters setup_dataDescription A function method for modifying or checking the data. The default method returns data unaltered. Usage html<div class="sourceCode r">Stat$setup_data(data, params) html</div> Arguments dataA data frame with the layer's data. paramsA list of parameters coming from the setup_params() method Value A data frame with layer data compute_layerDescription A function method for orchestrating the computation of the statistic. The default method splits the data and passes on computation tasks to the panel-level compute_panel() method. In addition, the default method handles missing values by removing rows that have missing values for the aesthetics listed in the required_aes and non_missing_aes fields. It is not recommended to use this method as an extension point. Usage html<div class="sourceCode r">Stat$compute_layer(data, params, layout) html</div> Arguments dataA data frame with the layer's data. paramsA list of parameters layoutA pre-trained <Layout> ggproto object. Value A data frame with computed data compute_panel,compute_groupDescription A function method orchestrating the computation of statistics for a single panel or group. The default compute_panel() method splits the data into groups, and passes on computation tasks to the compute_group() method. In addition, compute_panel() is tasked with preserving aesthetics that are constant within a group and preserving these if the computation loses them. The default compute_group() is not implemented. Usage html<div class="sourceCode r">Stat$compute_panel(data, scales, ...) Stat$compute_group(data, scales, ...) html</div> Arguments dataA data frame with the layer's data. scalesA list of pre-trained x and y scales. Note that the position scales are not finalised at this point and reflect the initial data range before computing stats. ...Reserved for extensions. By default, this passes parameters to the compute_group() method. Value A data frame with layer data finish_layerDescription A function method acting as a hook to modify data after scales have been applied, but before geoms have to render. The default is to pass the data unaltered. This can be used as an extension point when actual aesthetic values rather than values mapped to the aesthetic are needed. Usage html<div class="sourceCode r">Stat$finish_layer(data, params) html</div> Arguments dataA data frame with layer data paramsA list of parameters Value A data frame with layer data parametersDescription A function method for listing out all acceptable parameters for this stat. Usage html<div class="sourceCode r">Stat$parameters(extra) html</div> Arguments extraA boolean: whether to include the extra_params field. Value A character vector of parameter names. aestheticsDescription A function method for listing out all acceptable aesthetics for this stat. Usage html<div class="sourceCode r">Stat$aesthetics() html</div> Value A character vector of aesthetic names.
Conventions
The object name that a new class is assigned to is typically the same as the class name. Stat class names are in UpperCamelCase and start with the Stat* prefix, like StatNew. A constructor function is usually paired wih a Stat class. The constructor wraps a call to layer(), where e.g. layer(stat = StatNew). The constructor function name is formatted by taking the Stat class name and formatting it with snake_case, so that StatNew becomes stat_new().
absoluteGrob
Absolute grob
CRAN · 4.0.3 · ggplot2/man/absoluteGrob.Rd · 2026-05-07

This grob has fixed dimensions and position.

Aliases
absoluteGrob
Keywords
internal
Usage
absoluteGrob( grob, width = NULL, height = NULL, xmin = NULL, ymin = NULL, vp = NULL )
Details
It's still experimental
add_gg
Add components to a plot
CRAN · 4.0.3 · ggplot2/man/gg-add.Rd · 2026-05-07

+ is the key to constructing sophisticated ggplot2 graphics. It allows you to start simple, then get more and more complex, checking your work at each step.

Aliases
add_gg+.gg%+%
Usage
add_gg(e1, e2) e1 %+% e2
Arguments
e1
An object of class [=ggplot]ggplot() or a [=theme]theme().
e2
A plot component, as described below.
Examples
base <- ggplot(mpg, aes(displ, hwy)) + geom_point() base + geom_smooth() # To override the data, you must use %+% base %+% subset(mpg, fl == "p") # Alternatively, you can add multiple components with a list. # This can be useful to return from a function. base + list(subset(mpg, fl == "p"), geom_smooth())
See also
[=theme]theme()
Custom sections
What can you add?
You can add any of the following types of objects: An [=aes]aes() object replaces the default aesthetics. A layer created by a geom_ or stat_ function adds a new layer. A scale overrides the existing scale. A [=theme]theme() modifies the current theme. A coord overrides the current coordinate system. A facet specification overrides the current faceting. To replace the current default data frame, you must use %+%, due to S3 method precedence issues. You can also supply a list, in which case each element of the list will be added in turn.
add_theme
Modify properties of an element in a theme object
CRAN · 4.0.3 · ggplot2/man/add_theme.Rd · 2026-05-07

Modify properties of an element in a theme object

Aliases
add_theme
Keywords
internal
Usage
add_theme(t1, t2, t2name, call = caller_env())
Arguments
t1
A theme object
t2
A theme object that is to be added to t1
t2name
A name of the t2 object. This is used for printing informative error messages.
aes
Construct aesthetic mappings
CRAN · 4.0.3 · ggplot2/man/aes.Rd · 2026-05-07

Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms. Aesthetic mappings can be set in [=ggplot]ggplot() and in individual layers.

Aliases
aes
Concepts
aesthetics documentation
Usage
aes(x, y, ...)
Arguments
x, y, ...
<[rlang:topic-data-mask]data-masking> List of name-value pairs in the form aesthetic = variable describing which variables in the layer data should be mapped to which aesthetics used by the paired geom/stat. The expression variable is evaluated within the layer data, so there is no need to refer to the original dataset (i.e., use ggplot(df, aes(variable)) instead of ggplot(df, aes(df$variable))). The names for x and y aesthetics are typically omitted because they are so common; all other aesthetics must be named.
Details
This function also standardises aesthetic names by converting color to colour (also in substrings, e.g., point_color to point_colour) and translating old style R names to ggplot names (e.g., pch to shape and cex to size).
Value
An S7 object representing a list with class mapping. Components of the list are either quosures or constants.
Examples
aes(x = mpg, y = wt) aes(mpg, wt) # You can also map aesthetics to functions of variables aes(x = mpg ^ 2, y = wt / cyl) # Or to constants aes(x = 1, colour = "smooth") # Aesthetic names are automatically standardised aes(col = x) aes(fg = x) aes(color = x) aes(colour = x) # aes() is passed to either ggplot() or specific layer. Aesthetics supplied # to ggplot() are used as defaults for every layer. ggplot(mpg, aes(displ, hwy)) + geom_point() ggplot(mpg) + geom_point(aes(displ, hwy)) # Tidy evaluation ---------------------------------------------------- # aes() automatically quotes all its arguments, so you need to use tidy # evaluation to create wrappers around ggplot2 pipelines. The # simplest case occurs when your wrapper takes dots: scatter_by <- function(data, ...) ggplot(data) + geom_point(aes(...)) scatter_by(mtcars, disp, drat) # If your wrapper has a more specific interface with named arguments, # you need the "embrace operator": scatter_by <- function(data, x, y) ggplot(data) + geom_point(aes( x , y )) scatter_by(mtcars, disp, drat) # Note that users of your wrapper can use their own functions in the # quoted expressions and all will resolve as it should! cut3 <- function(x) cut_number(x, 3) scatter_by(mtcars, cut3(disp), drat)
See also
[=vars]vars() for another quoting function designed for faceting specifications. Run vignette("ggplot2-specs") to see an overview of other aesthetics that can be modified. [=aes_eval]Delayed evaluation for working with computed variables. Other aesthetics documentation: aes_colour_fill_alpha, aes_group_order, aes_linetype_size_shape, aes_position
Custom sections
Quasiquotation
aes() is a [rlang:topic-defuse]quoting function. This means that its inputs are quoted to be evaluated in the context of the data. This makes it easy to work with variables from the data frame because you can name those directly. The flip side is that you have to use [rlang:topic-inject]quasiquotation to program with aes(). See a tidy evaluation tutorial such as the https://dplyr.tidyverse.org/articles/programming.htmldplyr programming vignette to learn more about these techniques.
Note
Using I() to create objects of class 'AsIs' causes scales to ignore the variable and assumes the wrapped variable is direct input for the grid package. Please be aware that variables are sometimes combined, like in some stats or position adjustments, that may yield unexpected results with 'AsIs' variables.
aes_
Define aesthetic mappings programmatically
CRAN · 4.0.3 · ggplot2/man/aes_.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms. [=aes]aes() uses non-standard evaluation to capture the variable names. aes_() and aes_string() require you to explicitly quote the inputs either with "" for aes_string(), or with quote or ~ for aes_(). (aes_q() is an alias to aes_()). This makes aes_() and aes_string() easy to program with. aes_string() and aes_() are particularly useful when writing functions that create plots because you can use strings or quoted names/calls to define the aesthetic mappings, rather than having to use [=substitute]substitute() to generate a call to aes(). I recommend using aes_(), because creating the equivalents of aes(colour = "my colour") or aes(x = `X$1`) with aes_string() is quite clunky.

Aliases
aes_aes_stringaes_q
Keywords
internal
Usage
aes_(x, y, ...) aes_string(x, y, ...) aes_q(x, y, ...)
Arguments
x, y, ...
List of name value pairs. Elements must be either quoted calls, strings, one-sided formulas or constants.
See also
[=aes]aes()
Custom sections
Life cycle
All these functions are deprecated. Please use tidy evaluation idioms instead. Regarding aes_string(), you can replace it with .data pronoun. For example, the following code can achieve the same mapping as aes_string(x_var, y_var). html<div class="sourceCode r">x_var <- "foo" y_var <- "bar" aes(.data[[x_var]], .data[[y_var]]) html</div> For more details, please see vignette("ggplot2-in-packages").
aes_all
Given a character vector, create a set of identity mappings
CRAN · 4.0.3 · ggplot2/man/aes_all.Rd · 2026-05-07

Given a character vector, create a set of identity mappings

Aliases
aes_all
Keywords
internal
Usage
aes_all(vars)
Arguments
vars
vector of variable names
Examples
aes_all(names(mtcars)) aes_all(c("x", "y", "col", "pch"))
aes_auto
Automatic aesthetic mapping
CRAN · 4.0.3 · ggplot2/man/aes_auto.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated]

Aliases
aes_auto
Keywords
internal
Usage
aes_auto(data = NULL, ...)
Arguments
data
data.frame or names of variables
...
aesthetics that need to be explicitly mapped.
aes_colour_fill_alpha
Colour related aesthetics: colour, fill, and alpha
CRAN · 4.0.3 · ggplot2/man/aes_colour_fill_alpha.Rd · 2026-05-07

These aesthetics parameters change the colour (colour and fill) and the opacity (alpha) of geom elements on a plot. Almost every geom has either colour or fill (or both), as well as can have their alpha modified. Modifying colour on a plot is a useful way to enhance the presentation of data, often especially when a plot graphs more than two variables.

Aliases
aes_colour_fill_alphacolourcolorfill
Concepts
aesthetics documentation
Examples
# Bar chart example p <- ggplot(mtcars, aes(factor(cyl))) # Default plotting p + geom_bar() # To change the interior colouring use fill aesthetic p + geom_bar(fill = "red") # Compare with the colour aesthetic which changes just the bar outline p + geom_bar(colour = "red") # Combining both, you can see the changes more clearly p + geom_bar(fill = "white", colour = "red") # Both colour and fill can take an rgb specification. p + geom_bar(fill = "#00abff") # Use NA for a completely transparent colour. p + geom_bar(fill = NA, colour = "#00abff") # Colouring scales differ depending on whether a discrete or # continuous variable is being mapped. For example, when mapping # fill to a factor variable, a discrete colour scale is used. ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + geom_bar() # When mapping fill to continuous variable a continuous colour # scale is used. ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density)) # Some geoms only use the colour aesthetic but not the fill # aesthetic (e.g. geom_point() or geom_line()). p <- ggplot(economics, aes(x = date, y = unemploy)) p + geom_line() p + geom_line(colour = "green") p + geom_point() p + geom_point(colour = "red") # For large datasets with overplotting the alpha # aesthetic will make the points more transparent. set.seed(1) df <- data.frame(x = rnorm(5000), y = rnorm(5000)) p <- ggplot(df, aes(x,y)) p + geom_point() p + geom_point(alpha = 0.5) p + geom_point(alpha = 1/10) # Alpha can also be used to add shading. p <- ggplot(economics, aes(x = date, y = unemploy)) + geom_line() p yrng <- range(economics$unemploy) p <- p + geom_rect( aes(NULL, NULL, xmin = start, xmax = end, fill = party), ymin = yrng[1], ymax = yrng[2], data = presidential ) p p + scale_fill_manual(values = alpha(c("blue", "red"), .3))
See also
Other options for modifying colour: [=scale_colour_brewer]scale_colour_brewer(), [=scale_colour_gradient]scale_colour_gradient(), [=scale_colour_grey]scale_colour_grey(), [=scale_colour_hue]scale_colour_hue(), [=scale_colour_identity]scale_colour_identity(), [=scale_colour_manual]scale_colour_manual(), [=scale_colour_viridis_d]scale_colour_viridis_d() Other options for modifying fill: [=scale_fill_brewer]scale_fill_brewer(), [=scale_fill_gradient]scale_fill_gradient(), [=scale_fill_grey]scale_fill_grey(), [=scale_fill_hue]scale_fill_hue(), [=scale_fill_identity]scale_fill_identity(), [=scale_fill_manual]scale_fill_manual(), [=scale_fill_viridis_d]scale_fill_viridis_d() Other options for modifying alpha: [=scale_alpha]scale_alpha(), [=scale_alpha_manual]scale_alpha_manual(), [=scale_alpha_identity]scale_alpha_identity() Run vignette("ggplot2-specs") to see an overview of other aesthetics that can be modified. Other aesthetics documentation: aes(), aes_group_order, aes_linetype_size_shape, aes_position
Custom sections
Colour and fill
The colour aesthetic is used to draw lines and strokes, such as in [=geom_point]geom_point() and [=geom_line]geom_line(), but also the line contours of [=geom_rect]geom_rect() and [=geom_polygon]geom_polygon(). The fill aesthetic is used to colour the inside areas of geoms, such as [=geom_rect]geom_rect() and [=geom_polygon]geom_polygon(), but also the insides of shapes 21-25 of [=geom_point]geom_point(). Colours and fills can be specified in the following ways: A name, e.g., "red". R has 657 built-in named colours, which can be listed with [grDevices:colors]grDevices::colors(). An rgb specification, with a string of the form "#RRGGBB" where each of the pairs RR, GG, BB consists of two hexadecimal digits giving a value in the range 00 to FF. You can optionally make the colour transparent by using the form "#RRGGBBAA". An NA, for a completely transparent colour.
Alpha
Alpha refers to the opacity of a geom. Values of alpha range from 0 to 1, with lower values corresponding to more transparent colors. Alpha can additionally be modified through the colour or fill aesthetic if either aesthetic provides color values using an rgb specification ("#RRGGBBAA"), where AA refers to transparency values.
aes_eval
Control aesthetic evaluation
CRAN · 4.0.3 · ggplot2/man/aes_eval.Rd · 2026-05-07

Most [=aes]aesthetics are mapped from variables found in the data. Sometimes, however, you want to delay the mapping until later in the rendering process. ggplot2 has three stages of the data that you can map aesthetics from, and three functions to control at which stage aesthetics should be evaluated. after_stat() replaces the old approaches of using either stat(), e.g. stat(density), or surrounding the variable names with .., e.g. ..density...

Aliases
aes_evalafter_statstatafter_scalefrom_themestage
Usage
# These functions can be used inside the `aes()` function # used as the `mapping` argument in layers, for example: # geom_density(mapping = aes(y = after_stat(scaled))) after_stat(x) after_scale(x) from_theme(x) stage(start = NULL, after_stat = NULL, after_scale = NULL)
Arguments
x
<[rlang:topic-data-mask]data-masking> An aesthetic expression using variables calculated by the stat (after_stat()) or layer aesthetics (after_scale()).
start
<[rlang:topic-data-mask]data-masking> An aesthetic expression using variables from the layer data.
after_stat
<[rlang:topic-data-mask]data-masking> An aesthetic expression using variables calculated by the stat.
after_scale
<[rlang:topic-data-mask]data-masking> An aesthetic expression using layer aesthetics.
Examples
# Default histogram display ggplot(mpg, aes(displ)) + geom_histogram(aes(y = after_stat(count))) # Scale tallest bin to 1 ggplot(mpg, aes(displ)) + geom_histogram(aes(y = after_stat(count / max(count)))) # Use a transparent version of colour for fill ggplot(mpg, aes(class, hwy)) + geom_boxplot(aes(colour = class, fill = after_scale(alpha(colour, 0.4)))) # Use stage to modify the scaled fill ggplot(mpg, aes(class, hwy)) + geom_boxplot(aes(fill = stage(class, after_scale = alpha(fill, 0.4)))) # Making a proportional stacked density plot ggplot(mpg, aes(cty)) + geom_density( aes( colour = factor(cyl), fill = after_scale(alpha(colour, 0.3)), y = after_stat(count / sum(n[!duplicated(group)])) ), position = "stack", bw = 1 ) + geom_density(bw = 1) # Imitating a ridgeline plot ggplot(mpg, aes(cty, colour = factor(cyl))) + geom_ribbon( stat = "density", outline.type = "upper", aes( fill = after_scale(alpha(colour, 0.3)), ymin = after_stat(group), ymax = after_stat(group + ndensity) ) ) # Labelling a bar plot ggplot(mpg, aes(class)) + geom_bar() + geom_text( aes( y = after_stat(count + 2), label = after_stat(count) ), stat = "count" ) # Labelling the upper hinge of a boxplot, # inspired by June Choe ggplot(mpg, aes(displ, class)) + geom_boxplot(outlier.shape = NA) + geom_text( aes( label = after_stat(xmax), x = stage(displ, after_stat = xmax) ), stat = "boxplot", hjust = -0.5 )
Custom sections
Staging
Below follows an overview of the three stages of evaluation and how aesthetic evaluation can be controlled. Stage 1: direct input at the start The default is to map at the beginning, using the layer data provided by the user. If you want to map directly from the layer data you should not do anything special. This is the only stage where the original layer data can be accessed. html<div class="sourceCode r"># 'x' and 'y' are mapped directly ggplot(mtcars) + geom_point(aes(x = mpg, y = disp)) html</div> Stage 2: after stat transformation The second stage is after the data has been transformed by the layer stat. The most common example of mapping from stat transformed data is the height of bars in [=geom_histogram]geom_histogram(): the height does not come from a variable in the underlying data, but is instead mapped to the count computed by [=stat_bin]stat_bin(). In order to map from stat transformed data you should use the after_stat() function to flag that evaluation of the aesthetic mapping should be postponed until after stat transformation. Evaluation after stat transformation will have access to the variables calculated by the stat, not the original mapped values. The 'computed variables' section in each stat lists which variables are available to access. html<div class="sourceCode r"># The 'y' values for the histogram are computed by the stat ggplot(faithful, aes(x = waiting)) + geom_histogram() # Choosing a different computed variable to display, matching up the # histogram with the density plot ggplot(faithful, aes(x = waiting)) + geom_histogram(aes(y = after_stat(density))) + geom_density() html</div> Stage 3: after scale transformation The third and last stage is after the data has been transformed and mapped by the plot scales. An example of mapping from scaled data could be to use a desaturated version of the stroke colour for fill. You should use after_scale() to flag evaluation of mapping for after data has been scaled. Evaluation after scaling will only have access to the final aesthetics of the layer (including non-mapped, default aesthetics). html<div class="sourceCode r"># The exact colour is known after scale transformation ggplot(mpg, aes(cty, colour = factor(cyl))) + geom_density() # We re-use colour properties for the fill without a separate fill scale ggplot(mpg, aes(cty, colour = factor(cyl))) + geom_density(aes(fill = after_scale(alpha(colour, 0.3)))) html</div> Complex staging Sometimes, you may want to map the same aesthetic multiple times, e.g. map x to a data column at the start for the layer stat, but remap it later to a variable from the stat transformation for the layer geom. The stage() function allows you to control multiple mappings for the same aesthetic across all three stages of evaluation. html<div class="sourceCode r"># Use stage to modify the scaled fill ggplot(mpg, aes(class, hwy)) + geom_boxplot(aes(fill = stage(class, after_scale = alpha(fill, 0.4)))) # Using data for computing summary, but placing label elsewhere. # Also, we're making our own computed variables to use for the label. ggplot(mpg, aes(class, displ)) + geom_violin() + stat_summary( aes( y = stage(displ, after_stat = 8), label = after_stat(paste(mean, "±", sd)) ), geom = "text", fun.data = ~ round(data.frame(mean = mean(.x), sd = sd(.x)), 2) ) html</div> Conceptually, aes(x) is equivalent to aes(stage(start = x)), and aes(after_stat(count)) is equivalent to aes(stage(after_stat = count)), and so on. stage() is most useful when at least two of its arguments are specified. Theme access The from_theme() function can be used to acces the [=element_geom]element_geom() fields of the theme(geom) argument. Using aes(colour = from_theme(ink)) and aes(colour = from_theme(accent)) allows swapping between foreground and accent colours.
aes_group_order
Aesthetics: grouping
CRAN · 4.0.3 · ggplot2/man/aes_group_order.Rd · 2026-05-07

The group aesthetic is by default set to the interaction of all discrete variables in the plot. This choice often partitions the data correctly, but when it does not, or when no discrete variable is used in the plot, you will need to explicitly define the grouping structure by mapping group to a variable that has a different value for each group.

Aliases
aes_group_ordergroup
Concepts
aesthetics documentation
Details
For most applications the grouping is set implicitly by mapping one or more discrete variables to x, y, colour, fill, alpha, shape, size, and/or linetype. This is demonstrated in the examples below. There are three common cases where the default does not display the data correctly. geom_line() where there are multiple individuals and the plot tries to connect every observation, even across individuals, with a line. geom_line() where a discrete x-position implies groups, whereas observations span the discrete x-positions. When the grouping needs to be different over different layers, for example when computing a statistic on all observations when another layer shows individuals. The examples below use a longitudinal dataset, Oxboys, from the nlme package to demonstrate these cases. Oxboys records the heights (height) and centered ages (age) of 26 boys (Subject), measured on nine occasions (Occasion).
Examples
p <- ggplot(mtcars, aes(wt, mpg)) # A basic scatter plot p + geom_point(size = 4) # Using the colour aesthetic p + geom_point(aes(colour = factor(cyl)), size = 4) # Using the shape aesthetic p + geom_point(aes(shape = factor(cyl)), size = 4) # Using fill p <- ggplot(mtcars, aes(factor(cyl))) p + geom_bar() p + geom_bar(aes(fill = factor(cyl))) p + geom_bar(aes(fill = factor(vs))) # Using linetypes ggplot(economics_long, aes(date, value01)) + geom_line(aes(linetype = variable)) # Multiple groups with one aesthetic p <- ggplot(nlme::Oxboys, aes(age, height)) # The default is not sufficient here. A single line tries to connect all # the observations. p + geom_line() # To fix this, use the group aesthetic to map a different line for each # subject. p + geom_line(aes(group = Subject)) # Different groups on different layers p <- p + geom_line(aes(group = Subject)) # Using the group aesthetic with both geom_line() and geom_smooth() # groups the data the same way for both layers p + geom_smooth(aes(group = Subject), method = "lm", se = FALSE) # Changing the group aesthetic for the smoother layer # fits a single line of best fit across all boys p + geom_smooth(aes(group = 1), size = 2, method = "lm", se = FALSE) # Overriding the default grouping # Sometimes the plot has a discrete scale but you want to draw lines # that connect across groups. This is the strategy used in interaction # plots, profile plots, and parallel coordinate plots, among others. # For example, we draw boxplots of height at each measurement occasion. p <- ggplot(nlme::Oxboys, aes(Occasion, height)) + geom_boxplot() p # There is no need to specify the group aesthetic here; the default grouping # works because occasion is a discrete variable. To overlay individual # trajectories, we again need to override the default grouping for that layer # with aes(group = Subject) p + geom_line(aes(group = Subject), colour = "blue")
See also
Geoms commonly used with groups: [=geom_bar]geom_bar(), [=geom_histogram]geom_histogram(), [=geom_line]geom_line() Run vignette("ggplot2-specs") to see an overview of other aesthetics that can be modified. Other aesthetics documentation: aes(), aes_colour_fill_alpha, aes_linetype_size_shape, aes_position
aes_linetype_size_shape
Differentiation related aesthetics: linetype, size, shape
CRAN · 4.0.3 · ggplot2/man/aes_linetype_size_shape.Rd · 2026-05-07

The linetype, linewidth, size, and shape aesthetics modify the appearance of lines and/or points. They also apply to the outlines of polygons (linetype and linewidth) or to text (size).

Aliases
aes_linetype_size_shapelinetypesizeshape
Concepts
aesthetics documentation
Examples
df <- data.frame(x = 1:10 , y = 1:10) p <- ggplot(df, aes(x, y)) p + geom_line(linetype = 2) p + geom_line(linetype = "dotdash") # An example with hex strings; the string "33" specifies three units on followed # by three off and "3313" specifies three units on followed by three off followed # by one on and finally three off. p + geom_line(linetype = "3313") # Mapping line type from a grouping variable ggplot(economics_long, aes(date, value01)) + geom_line(aes(linetype = variable)) # Linewidth examples ggplot(economics, aes(date, unemploy)) + geom_line(linewidth = 2, lineend = "round") ggplot(economics, aes(date, unemploy)) + geom_line(aes(linewidth = uempmed), lineend = "round") # Size examples p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(size = 4) p + geom_point(aes(size = qsec)) p + geom_point(size = 2.5) + geom_hline(yintercept = 25, size = 3.5) # Shape examples p + geom_point() p + geom_point(shape = 5) p + geom_point(shape = "k", size = 3) p + geom_point(shape = ".") p + geom_point(shape = NA) p + geom_point(aes(shape = factor(cyl))) # A look at all 25 symbols df2 <- data.frame(x = 1:5 , y = 1:25, z = 1:25) p <- ggplot(df2, aes(x, y)) p + geom_point(aes(shape = z), size = 4) + scale_shape_identity() # While all symbols have a foreground colour, symbols 19-25 also take a # background colour (fill) p + geom_point(aes(shape = z), size = 4, colour = "Red") + scale_shape_identity() p + geom_point(aes(shape = z), size = 4, colour = "Red", fill = "Black") + scale_shape_identity()
See also
[=geom_line]geom_line() and [=geom_point]geom_point() for geoms commonly used with these aesthetics. [=aes_group_order]aes_group_order() for using linetype, size, or shape for grouping. Scales that can be used to modify these aesthetics: [=scale_linetype]scale_linetype(), [=scale_linewidth]scale_linewidth(), [=scale_size]scale_size(), and [=scale_shape]scale_shape(). Run vignette("ggplot2-specs") to see an overview of other aesthetics that can be modified. Other aesthetics documentation: aes(), aes_colour_fill_alpha, aes_group_order, aes_position
Custom sections
Linetype
The linetype aesthetic can be specified with either an integer (0-6), a name (0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash), a mapping to a discrete variable, or a string of an even number (up to eight) of hexadecimal digits which give the lengths in consecutive positions in the string. See examples for a hex string demonstration.
Linewidth and stroke
The linewidth aesthetic sets the widths of lines, and can be specified with a numeric value (for historical reasons, these units are about 0.75 millimetres). Alternatively, they can also be set via mapping to a continuous variable. The stroke aesthetic serves the same role for points, but is distinct for discriminating points from lines in geoms such as [=geom_pointrange]geom_pointrange().
Size
The size aesthetic control the size of points and text, and can be specified with a numerical value (in millimetres) or via a mapping to a continuous variable.
Shape
The shape aesthetic controls the symbols of points, and can be specified with an integer (between 0 and 25), a single character (which uses that character as the plotting symbol), a . to draw the smallest rectangle that is visible (i.e., about one pixel), an NA to draw nothing, or a mapping to a discrete variable. Symbols and filled shapes are described in the examples below.
aes_position
Position related aesthetics: x, y, xmin, xmax, ymin, ymax, xend, yend
CRAN · 4.0.3 · ggplot2/man/aes_position.Rd · 2026-05-07

The following aesthetics can be used to specify the position of elements: x, y, xmin, xmax, ymin, ymax, xend, yend.

Aliases
aes_positionxyxminxmaxyminymaxxendyend
Concepts
aesthetics documentation
Details
x and y define the locations of points or of positions along a line or path. x, y and xend, yend define the starting and ending points of segment and curve geometries. xmin, xmax, ymin and ymax can be used to specify the position of annotations and to represent rectangular areas. In addition, there are position aesthetics that are contextual to the geometry that they're used in. These are xintercept, yintercept, xmin_final, ymin_final, xmax_final, ymax_final, xlower, lower, xmiddle, middle, xupper, upper, x0 and y0. Many of these are used and automatically computed in [=geom_boxplot]geom_boxplot(). Relation to width and height The position aesthetics mentioned above like x and y are all location based. The width and height aesthetics are closely related length based aesthetics, but are not position aesthetics. Consequently, x and y aesthetics respond to scale transformations, whereas the length based width and height aesthetics are not transformed by scales. For example, if we have the pair x = 10, width = 2, that gets translated to the locations xmin = 9, xmax = 11 when using the default identity scales. However, the same pair becomes xmin = 1, xmax = 100 when using log10 scales, as width = 2 in log10-space spans a 100-fold change.
Examples
# Generate data: means and standard errors of means for prices # for each type of cut dmod <- lm(price ~ cut, data = diamonds) cut <- unique(diamonds$cut) cuts_df <- data.frame( cut, predict(dmod, data.frame(cut), se = TRUE)[c("fit", "se.fit")] ) ggplot(cuts_df) + aes( x = cut, y = fit, ymin = fit - se.fit, ymax = fit + se.fit, colour = cut ) + geom_pointrange() # Using annotate p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() p p + annotate( "rect", xmin = 2, xmax = 3.5, ymin = 2, ymax = 25, fill = "dark grey", alpha = .5 ) # Geom_segment examples p + geom_segment( aes(x = 2, y = 15, xend = 2, yend = 25), arrow = arrow(length = unit(0.5, "cm")) ) p + geom_segment( aes(x = 2, y = 15, xend = 3, yend = 15), arrow = arrow(length = unit(0.5, "cm")) ) p + geom_segment( aes(x = 5, y = 30, xend = 3.5, yend = 25), arrow = arrow(length = unit(0.5, "cm")) ) # You can also use geom_segment() to recreate plot(type = "h") # from base R: set.seed(1) counts <- as.data.frame(table(x = rpois(100, 5))) counts$x <- as.numeric(as.character(counts$x)) with(counts, plot(x, Freq, type = "h", lwd = 10)) ggplot(counts, aes(x = x, y = Freq)) + geom_segment(aes(yend = 0, xend = x), size = 10)
See also
Geoms that commonly use these aesthetics: [=geom_crossbar]geom_crossbar(), [=geom_curve]geom_curve(), [=geom_errorbar]geom_errorbar(), [=geom_line]geom_line(), [=geom_linerange]geom_linerange(), [=geom_path]geom_path(), [=geom_point]geom_point(), [=geom_pointrange]geom_pointrange(), [=geom_rect]geom_rect(), [=geom_segment]geom_segment() Scales that can be used to modify positions: [=scale_x_continuous]scale_continuous(), [=scale_x_discrete]scale_discrete(), [=scale_x_binned]scale_binned(), [=scale_x_date]scale_date(). See also [=annotate]annotate() for placing annotations. Other aesthetics documentation: aes(), aes_colour_fill_alpha, aes_group_order, aes_linetype_size_shape
annotate
Create an annotation layer
CRAN · 4.0.3 · ggplot2/man/annotate.Rd · 2026-05-07

This function adds geoms to a plot, but unlike a typical geom function, the properties of the geoms are not mapped from variables of a data frame, but are instead passed in as vectors. This is useful for adding small annotations (such as text labels) or if you have your data in vectors, and for some reason don't want to put them in a data frame.

Aliases
annotate
Usage
annotate( geom, x = NULL, y = NULL, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, xend = NULL, yend = NULL, ..., na.rm = FALSE )
Arguments
geom
name of geom to use for annotation
x, y, xmin, ymin, xmax, ymax, xend, yend
positioning aesthetics - you must specify at least one of these.
...
Other arguments passed on to [=layer]layer()'s params argument. These arguments broadly fall into one of 4 categories below. Notably, further arguments to the position argument, or aesthetics that are required can not be passed through .... Unknown arguments that are not part of the 4 categories below are ignored. Static aesthetics that are not mapped to a scale, but are at a fixed value and apply to the layer as a whole. For example, colour = "red" or linewidth = 3. The geom's documentation has an Aesthetics section that lists the available options. The 'required' aesthetics cannot be passed on to the params. Please note that while passing unmapped aesthetics as vectors is technically possible, the order and required length is not guaranteed to be parallel to the input data. When constructing a layer using a stat_*() function, the ... argument can be used to pass on parameters to the geom part of the layer. An example of this is stat_density(geom = "area", outline.type = "both"). The geom's documentation lists which parameters it can accept. Inversely, when constructing a layer using a geom_*() function, the ... argument can be used to pass on parameters to the stat part of the layer. An example of this is geom_area(stat = "density", adjust = 0.5). The stat's documentation lists which parameters it can accept. The key_glyph argument of [=layer]layer() may also be passed on through .... This can be one of the functions described as [=draw_key]key glyphs, to change the display of the layer in the legend.
na.rm
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.
Details
Note that all position aesthetics are scaled (i.e. they will expand the limits of the plot so they are visible), but all other aesthetics are set. This means that layers created with this function will never affect the legend.
Examples
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() p + annotate("text", x = 4, y = 25, label = "Some text") p + annotate("text", x = 2:5, y = 25, label = "Some text") p + annotate("rect", xmin = 3, xmax = 4.2, ymin = 12, ymax = 21, alpha = .2) p + annotate("segment", x = 2.5, xend = 4, y = 15, yend = 25, colour = "blue") p + annotate("pointrange", x = 3.5, y = 20, ymin = 12, ymax = 28, colour = "red", size = 2.5, linewidth = 1.5) p + annotate("text", x = 2:3, y = 20:21, label = c("my label", "label 2")) p + annotate("text", x = 4, y = 25, label = "italic(R) ^ 2 == 0.75", parse = TRUE) p + annotate("text", x = 4, y = 25, label = "paste(italic(R) ^ 2, \" = .75\")", parse = TRUE)
See also
The https://ggplot2-book.org/annotations#sec-custom-annotationscustom annotations section of the online ggplot2 book.
Custom sections
Unsupported geoms
Due to their special nature, reference line geoms [=geom_abline]geom_abline(), [=geom_hline]geom_hline(), and [=geom_vline]geom_vline() can't be used with annotate(). You can use these geoms directly for annotations.
annotation_borders
Create a layer of map borders
CRAN · 4.0.3 · ggplot2/man/annotation_borders.Rd · 2026-05-07

This is a quick and dirty way to get map data (from the maps package) onto your plot. This is a good place to start if you need some crude reference lines, but you'll typically want something more sophisticated for communication graphics.

Aliases
annotation_bordersborders
Usage
annotation_borders( database = "world", regions = ".", fill = NA, colour = "grey50", xlim = NULL, ylim = NULL, ... ) borders(...) # Deprecated
Arguments
database
map data, see [maps:map]maps::map() for details
regions
map region
fill
fill colour
colour
border colour
xlim, ylim
latitudinal and longitudinal ranges for extracting map polygons, see [maps:map]maps::map() for details.
...
Arguments passed on to [=geom_polygon]geom_polygon lineendLine end style (round, butt, square). linejoinLine join style (round, mitre, bevel). linemitreLine mitre limit (number greater than 1). ruleEither "evenodd" or "winding". If polygons with holes are being drawn (using the subgroup aesthetic) this argument defines how the hole coordinates are interpreted. See the examples in [grid:grid.path]grid::pathGrob() for an explanation. mappingSet of aesthetic mappings created by [=aes]aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping. dataThe data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to [=ggplot]ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See [=fortify]fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)). statThe statistical transformation to use on the data for this layer. When using a geom_*() function to construct a layer, the stat argument can be used to override the default coupling between geoms and stats. The stat argument accepts the following: A Stat ggproto subclass, for example StatCount. A string naming the stat. To give the stat as a string, strip the function name of the stat_ prefix. For example, to use stat_count(), give the stat as "count". For more information and other ways to specify the stat, see the [=layer_stats]layer stat documentation. positionA position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following: The
Examples
if (require("maps")) data(us.cities) capitals <- subset(us.cities, capital == 2) ggplot(capitals, aes(long, lat)) + annotation_borders("state") + geom_point(aes(size = pop)) + scale_size_area() + coord_quickmap() if (require("maps")) # Same map, with some world context ggplot(capitals, aes(long, lat)) + annotation_borders("world", xlim = c(-130, -60), ylim = c(20, 50)) + geom_point(aes(size = pop)) + scale_size_area() + coord_quickmap()
annotation_custom
Annotation: Custom grob
CRAN · 4.0.3 · ggplot2/man/annotation_custom.Rd · 2026-05-07

This is a special geom intended for use as static annotations that are the same in every panel. These annotations will not affect scales (i.e. the x and y axes will not grow to cover the range of the grob, and the grob will not be modified by any ggplot settings or mappings).

Aliases
annotation_custom
Usage
annotation_custom(grob, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
Arguments
grob
grob to display
xmin, xmax
x location (in data coordinates) giving horizontal location of raster
ymin, ymax
y location (in data coordinates) giving vertical location of raster
Details
Most useful for adding tables, inset plots, and other grid-based decorations.
Examples
# Dummy plot df <- data.frame(x = 1:10, y = 1:10) base <- ggplot(df, aes(x, y)) + geom_blank() + theme_bw() # Full panel annotation base + annotation_custom( grob = grid::roundrectGrob(), xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf ) # Inset plot df2 <- data.frame(x = 1 , y = 1) g <- ggplotGrob(ggplot(df2, aes(x, y)) + geom_point() + theme(plot.background = element_rect(colour = "black"))) base + annotation_custom(grob = g, xmin = 1, xmax = 10, ymin = 8, ymax = 10)
Note
annotation_custom() expects the grob to fill the entire viewport defined by xmin, xmax, ymin, ymax. Grobs with a different (absolute) size will be center-justified in that region. Inf values can be used to fill the full plot panel (see examples).
annotation_logticks
Annotation: log tick marks
CRAN · 4.0.3 · ggplot2/man/annotation_logticks.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#supersededlifecycle-superseded.svgoptions: alt='[Superseded]'[Superseded] This function is superseded by using [=guide_axis_logticks]guide_axis_logticks(). This annotation adds log tick marks with diminishing spacing. These tick marks probably make sense only for base 10.

Aliases
annotation_logticks
Usage
annotation_logticks( base = 10, sides = "bl", outside = FALSE, scaled = TRUE, short = unit(0.1, "cm"), mid = unit(0.2, "cm"), long = unit(0.3, "cm"), colour = "black", linewidth = 0.5, linetype = 1, alpha = 1, color = NULL, ..., size = deprecated() )
Arguments
base
the base of the log (default 10)
sides
a string that controls which sides of the plot the log ticks appear on. It can be set to a string containing any of "trbl", for top, right, bottom, and left.
outside
logical that controls whether to move the log ticks outside of the plot area. Default is off (FALSE). You will also need to use coord_cartesian(clip = "off"). See examples.
scaled
is the data already log-scaled? This should be TRUE (default) when the data is already transformed with log10() or when using scale_y_log10(). It should be FALSE when using coord_transform(y = "log10").
short
a [grid:unit]grid::unit() object specifying the length of the short tick marks
mid
a [grid:unit]grid::unit() object specifying the length of the middle tick marks. In base 10, these are the "5" ticks.
long
a [grid:unit]grid::unit() object specifying the length of the long tick marks. In base 10, these are the "1" (or "10") ticks.
colour
Colour of the tick marks.
linewidth
Thickness of tick marks, in mm.
linetype
Linetype of tick marks (solid, dashed, etc.)
alpha
The transparency of the tick marks.
color
An alias for colour.
...
Other parameters passed on to the layer
size
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated]
Examples
# Make a log-log plot (without log ticks) a <- ggplot(msleep, aes(bodywt, brainwt)) + geom_point(na.rm = TRUE) + scale_x_log10( breaks = scales::trans_breaks("log10", \(x) 10^x), labels = scales::trans_format("log10", scales::math_format(10^.x)) ) + scale_y_log10( breaks = scales::trans_breaks("log10", \(x) 10^x), labels = scales::trans_format("log10", scales::math_format(10^.x)) ) + theme_bw() a + annotation_logticks() # Default: log ticks on bottom and left a + annotation_logticks(sides = "lr") # Log ticks for y, on left and right a + annotation_logticks(sides = "trbl") # All four sides a + annotation_logticks(sides = "lr", outside = TRUE) + coord_cartesian(clip = "off") # Ticks outside plot # Hide the minor grid lines because they don't align with the ticks a + annotation_logticks(sides = "trbl") + theme(panel.grid.minor = element_blank()) # Another way to get the same results as 'a' above: log-transform the data before # plotting it. Also hide the minor grid lines. b <- ggplot(msleep, aes(log10(bodywt), log10(brainwt))) + geom_point(na.rm = TRUE) + scale_x_continuous(name = "body", labels = scales::label_math(10^.x)) + scale_y_continuous(name = "brain", labels = scales::label_math(10^.x)) + theme_bw() + theme(panel.grid.minor = element_blank()) b + annotation_logticks() # Using a coordinate transform requires scaled = FALSE t <- ggplot(msleep, aes(bodywt, brainwt)) + geom_point() + coord_transform(x = "log10", y = "log10") + theme_bw() t + annotation_logticks(scaled = FALSE) # Change the length of the ticks a + annotation_logticks( short = unit(.5,"mm"), mid = unit(3,"mm"), long = unit(4,"mm") )
See also
[=scale_y_continuous]scale_y_continuous(), [=scale_y_log10]scale_y_log10() for log scale transformations. [=coord_transform]coord_transform() for log coordinate transformations.
annotation_map
Annotation: a map
CRAN · 4.0.3 · ggplot2/man/annotation_map.Rd · 2026-05-07

Display a fixed map on a plot. This function predates the [=geom_sf]geom_sf() framework and does not work with sf geometry columns as input. However, it can be used in conjunction with geom_sf() layers and/or [=coord_sf]coord_sf() (see examples).

Aliases
annotation_map
Usage
annotation_map(map, ...)
Arguments
map
Data frame representing a map. See [=geom_map]geom_map() for details.
...
Other arguments used to modify visual parameters, such as colour or fill.
Examples
if (requireNamespace("maps", quietly = TRUE)) # location of cities in North Carolina df <- data.frame( name = c("Charlotte", "Raleigh", "Greensboro"), lat = c(35.227, 35.772, 36.073), long = c(-80.843, -78.639, -79.792) ) p <- ggplot(df, aes(x = long, y = lat)) + annotation_map( map_data("state"), fill = "antiquewhite", colour = "darkgrey" ) + geom_point(color = "blue") + geom_text( aes(label = name), hjust = 1.105, vjust = 1.05, color = "blue" ) # use without coord_sf() is possible but not recommended p + xlim(-84, -76) + ylim(34, 37.2) if (requireNamespace("sf", quietly = TRUE)) # use with coord_sf() for appropriate projection p + coord_sf( crs = sf::st_crs(3347), default_crs = sf::st_crs(4326), # data is provided as long-lat xlim = c(-84, -76), ylim = c(34, 37.2) ) # you can mix annotation_map() and geom_sf() nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) p + geom_sf( data = nc, inherit.aes = FALSE, fill = NA, color = "black", linewidth = 0.1 ) + coord_sf(crs = sf::st_crs(3347), default_crs = sf::st_crs(4326))
annotation_raster
Annotation: high-performance rectangular tiling
CRAN · 4.0.3 · ggplot2/man/annotation_raster.Rd · 2026-05-07

This is a special version of [=geom_raster]geom_raster() optimised for static annotations that are the same in every panel. These annotations will not affect scales (i.e. the x and y axes will not grow to cover the range of the raster, and the raster must already have its own colours). This is useful for adding bitmap images.

Aliases
annotation_raster
Usage
annotation_raster(raster, xmin, xmax, ymin, ymax, interpolate = FALSE)
Arguments
raster
raster object to display, may be an array or a nativeRaster
xmin, xmax
x location (in data coordinates) giving horizontal location of raster
ymin, ymax
y location (in data coordinates) giving vertical location of raster
interpolate
If TRUE interpolate linearly, if FALSE (the default) don't interpolate.
Examples
# Generate data rainbow <- matrix(hcl(seq(0, 360, length.out = 50 * 50), 80, 70), nrow = 50) ggplot(mtcars, aes(mpg, wt)) + geom_point() + annotation_raster(rainbow, 15, 20, 3, 4) # To fill up whole plot ggplot(mtcars, aes(mpg, wt)) + annotation_raster(rainbow, -Inf, Inf, -Inf, Inf) + geom_point() rainbow2 <- matrix(hcl(seq(0, 360, length.out = 10), 80, 70), nrow = 1) ggplot(mtcars, aes(mpg, wt)) + annotation_raster(rainbow2, -Inf, Inf, -Inf, Inf) + geom_point() rainbow2 <- matrix(hcl(seq(0, 360, length.out = 10), 80, 70), nrow = 1) ggplot(mtcars, aes(mpg, wt)) + annotation_raster(rainbow2, -Inf, Inf, -Inf, Inf, interpolate = TRUE) + geom_point()
as.list.ggproto
Convert a ggproto object to a list
CRAN · 4.0.3 · ggplot2/man/as.list.ggproto.Rd · 2026-05-07

This will not include the object's super member.

Aliases
as.list.ggproto
Keywords
internal
Usage
as.listggproto(x, inherit = TRUE, ...)
Arguments
x
A ggproto object to convert to a list.
inherit
If TRUE (the default), flatten all inherited items into the returned list. If FALSE, do not include any inherited items.
...
Arguments passed on to [base:list]base::as.list.environment all.namesa logical indicating whether to copy all values or (default) only those whose names do not begin with a dot. sorteda logical indicating whether the [base]names of the resulting list should be sorted (increasingly). Note that this is somewhat costly, but may be useful for comparison of environments.
as_labeller
Coerce to labeller function
CRAN · 4.0.3 · ggplot2/man/as_labeller.Rd · 2026-05-07

This transforms objects to labeller functions. Used internally by [=labeller]labeller().

Aliases
as_labeller
Keywords
internal
Usage
as_labeller(x, default = label_value, multi_line = TRUE)
Arguments
x
Object to coerce to a labeller function. If a named character vector, it is used as a lookup table before being passed on to default. If a non-labeller function, it is assumed it takes and returns character vectors and is applied to the labels. If a labeller, it is simply applied to the labels.
default
Default labeller to process the labels produced by lookup tables or modified by non-labeller functions.
multi_line
Whether to display the labels of multiple factors on separate lines. This is passed to the labeller function.
Examples
p <- ggplot(mtcars, aes(disp, drat)) + geom_point() p + facet_wrap(~am) # Rename labels on the fly with a lookup character vector to_string <- as_labeller(c(`0` = "Zero", `1` = "One")) p + facet_wrap(~am, labeller = to_string) # Quickly transform a function operating on character vectors to a # labeller function: appender <- function(string, suffix = "-foo") paste0(string, suffix) p + facet_wrap(~am, labeller = as_labeller(appender)) # If you have more than one faceting variable, be sure to dispatch # your labeller to the right variable with labeller() p + facet_grid(cyl ~ am, labeller = labeller(am = to_string))
See also
[=labeller]labeller(), labellers
autolayer
Create a ggplot layer appropriate to a particular data type
CRAN · 4.0.3 · ggplot2/man/autolayer.Rd · 2026-05-07

autolayer() uses ggplot2 to draw a particular layer for an object of a particular class in a single command. This defines the S3 generic that other classes and packages can extend.

Aliases
autolayer
Concepts
plotting automation topics
Usage
autolayer(object, ...)
Arguments
object
an object, whose class will determine the behaviour of autolayer
...
other arguments passed to specific methods
Value
a ggplot layer
See also
Other plotting automation topics: automatic_plotting, autoplot(), fortify()
automatic_plotting
Tailoring plots to particular data types
CRAN · 4.0.3 · ggplot2/man/automatic_plotting.Rd · 2026-05-07

There are three functions to make plotting particular data types easier: autoplot(), autolayer() and fortify(). These are S3 generics for which other packages can write methods to display classes of data. The three functions are complementary and allow different levels of customisation. Below we'll explore implementing this series of methods to automate plotting of some class. Let's suppose we are writing a packages that has a class called 'my_heatmap', that wraps a matrix and we'd like users to easily plot this heatmap. html<div class="sourceCode r">my_heatmap <- function(...) \ m <- matrix(...) class(m) <- c("my_heatmap", class(m)) m \ my_data <- my_heatmap(volcano) html</div>

Aliases
automatic_plotting
Concepts
plotting automation topics
See also
Other plotting automation topics: autolayer(), autoplot(), fortify()
Custom sections
Automatic data shaping
One of the things we have to do is ensure that the data is shaped in the long format so that it is compatible with ggplot2. This is the job of the fortify() function. Because 'my_heatmap' wraps a matrix, we can let the fortify method 'melt' the matrix to a long format. If your data is already based on a long-format <data.frame>, you can skip implementing a fortify() method. html<div class="sourceCode r">fortify.my_heatmap <- function(model, ...) \ data.frame( row = as.vector(row(model)), col = as.vector(col(model)), value = as.vector(model) ) \ fortify(my_data) html</div> When you have implemented the fortify() method, it should be easier to construct a plot with the data than with the matrix. html<div class="sourceCode r">ggplot(my_data, aes(x = col, y = row, fill = value)) + geom_raster() html</div>
Automatic layers
A next step in automating plotting of your data type is to write an autolayer() method. These are typically wrappers around geoms or stats that automatically set aesthetics or other parameters. If you haven't implemented a fortify() method for your data type, you might have to reshape the data in autolayer(). If you require multiple layers to display your data type, you can use an autolayer() method that constructs a list of layers, which can be added to a plot. html<div class="sourceCode r">autolayer.my_heatmap <- function(object, ...) \ geom_raster( mapping = aes(x = col, y = row, fill = value), data = object, ..., inherit.aes = FALSE ) \ ggplot() + autolayer(my_data) html</div> As a quick tip: if you define a mapping in autolayer(), you might want to set inherit.aes = FALSE to not have aesthetics set in other layers interfere with your layer.
Automatic plots
The last step in automating plotting is to write an autoplot() method for your data type. The expectation is that these return a complete plot. In the example below, we're exploiting the autolayer() method that we have already written to make a complete plot. html<div class="sourceCode r">autoplot.my_heatmap <- function(object, ..., option = "magma") \ ggplot() + autolayer(my_data) + scale_fill_viridis_c(option = option) + theme_void() \ autoplot(my_data) html</div> If you don't have a wish to implement a base R plotting method, you can set the plot method for your class to the autoplot method. html<div class="sourceCode r">plot.my_heatmap <- autoplot.my_heatmap plot(my_data) html</div>
autoplot
Create a complete ggplot appropriate to a particular data type
CRAN · 4.0.3 · ggplot2/man/autoplot.Rd · 2026-05-07

autoplot() uses ggplot2 to draw a particular plot for an object of a particular class in a single command. This defines the S3 generic that other classes and packages can extend.

Aliases
autoplot
Concepts
plotting automation topics
Usage
autoplot(object, ...)
Arguments
object
an object, whose class will determine the behaviour of autoplot
...
other arguments passed to specific methods
Value
a ggplot object
See also
Other plotting automation topics: autolayer(), automatic_plotting, fortify()
benchplot
Benchmark plot creation time. Broken down into construct, build, render and draw times.
CRAN · 4.0.3 · ggplot2/man/benchplot.Rd · 2026-05-07

Benchmark plot creation time. Broken down into construct, build, render and draw times.

Aliases
benchplot
Keywords
internal
Usage
benchplot(x)
Arguments
x
code to create ggplot2 plot
Examples
benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point()) benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_grid(. ~ cyl)) # With tidy eval: p <- expr(ggplot(mtcars, aes(mpg, wt)) + geom_point()) benchplot(!!p)
bidirection
Utilities for working with bidirectional layers
CRAN · 4.0.3 · ggplot2/man/bidirection.Rd · 2026-05-07

These functions are what underpins the ability of certain geoms to work automatically in both directions. See the Extending ggplot2 vignette for how they are used when implementing Geom, Stat, and Position classes.

Aliases
bidirectionhas_flipped_aesflip_dataflipped_names
Keywords
internal
Usage
has_flipped_aes( data, params = list(), main_is_orthogonal = NA, range_is_orthogonal = NA, group_has_equal = FALSE, ambiguous = FALSE, main_is_continuous = FALSE, main_is_optional = FALSE, default = FALSE ) flip_data(data, flip = NULL) flipped_names(flip = FALSE)
Arguments
data
The layer data
params
The parameters of the Stat/Geom. Only the orientation parameter will be used.
main_is_orthogonal
If only x or y are present do they correspond to the main orientation or the reverse. E.g. If TRUE and y is present it is not flipped. If NA this check will be ignored.
range_is_orthogonal
If xmin/xmax or ymin/ymax is present do they correspond to the main orientation or reverse. If NA this check will be ignored.
group_has_equal
Is it expected that grouped data has either a single x or y value that will correspond to the orientation.
ambiguous
Is the layer ambiguous in its mapping by nature. If so, it will only be flipped if params$orientation == "y"
main_is_continuous
If there is a discrete and continuous axis, does the continuous one correspond to the main orientation?
main_is_optional
Is the main axis aesthetic optional and, if not given, set to 0
default
The logical value to return if no orientation can be discerned from the data.
flip
Logical. Is the layer flipped.
Details
has_flipped_aes() is used to sniff out the orientation of the layer from the data. It has a range of arguments that can be used to finetune the sniffing based on what the data should look like. flip_data() will switch the column names of the data so that it looks like x-oriented data. flipped_names() provides a named list of aesthetic names that corresponds to the orientation of the layer.
Value
has_flipped_aes() returns TRUE if it detects a layer in the other orientation and FALSE otherwise. flip_data() will return the input unchanged if flip = FALSE and the data with flipped aesthetic names if flip = TRUE. flipped_names() returns a named list of strings. If flip = FALSE the name of the element will correspond to the element, e.g. flipped_names(FALSE)$x == "x" and if flip = TRUE it will correspond to the flipped name, e.g. flipped_names(FALSE)$x == "y"
Custom sections
Controlling the sniffing
How the layer data should be interpreted depends on its specific features. has_flipped_aes() contains a range of flags for defining what certain features in the data correspond to: main_is_orthogonal: This argument controls how the existence of only a x or y aesthetic is understood. If TRUE then the existing aesthetic would be then secondary axis. This behaviour is present in [=stat_ydensity]stat_ydensity() and [=stat_boxplot]stat_boxplot(). If FALSE then the existing aesthetic is the main axis as seen in e.g. [=stat_bin]stat_bin(), [=geom_count]geom_count(), and [=stat_density]stat_density(). range_is_orthogonal: This argument controls whether the existence of range-like aesthetics (e.g. xmin and xmax) represents the main or secondary axis. If TRUE then the range is given for the secondary axis as seen in e.g. [=geom_ribbon]geom_ribbon() and [=geom_linerange]geom_linerange(). group_has_equal: This argument controls whether to test for equality of all x and y values inside each group and set the main axis to the one where all is equal. This test is only performed if TRUE, and only after less computationally heavy tests has come up empty handed. Examples are [=stat_boxplot]stat_boxplot() and stat_ydensity ambiguous: This argument tells the function that the layer, while bidirectional, doesn't treat each axis differently. It will circumvent any data based guessing and only take hint from the orientation element in params. If this is not present it will fall back to FALSE. Examples are [=geom_line]geom_line() and [=geom_area]geom_area() main_is_continuous: This argument controls how the test for discreteness in the scales should be interpreted. If TRUE then the main axis will be the one which is not discrete-like. Conversely, if FALSE the main axis will be the discrete-like one. Examples of TRUE is [=stat_density]stat_density() and [=stat_bin]stat_bin(), while examples of FALSE is [=stat_ydensity]stat_ydensity() and [=stat_boxplot]stat_boxplot() main_is_optional: This argument controls the rare case of layers were the main direction is an optional aesthetic. This is only seen in [=stat_boxplot]stat_boxplot() where x is set to 0 if not given. If TRUE there will be a check for whether all x or all y are equal to 0
binned_scale
Binning scale constructor
CRAN · 4.0.3 · ggplot2/man/binned_scale.Rd · 2026-05-07

Binning scale constructor

Aliases
binned_scale
Keywords
internal
Usage
binned_scale( aesthetics, scale_name = deprecated(), palette, name = waiver(), breaks = waiver(), labels = waiver(), limits = NULL, rescaler = rescale, oob = squish, expand = waiver(), na.value = NA_real_, n.breaks = NULL, nice.breaks = TRUE, right = TRUE, transform = "identity", trans = deprecated(), show.limits = FALSE, guide = "bins", position = "left", fallback.palette = NULL, call = caller_call(), super = ScaleBinned )
Arguments
aesthetics
The names of the aesthetics that this scale works with.
scale_name
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] The name of the scale that should be used for error messages associated with this scale.
palette
A palette function that when called with a numeric vector with values between 0 and 1 returns the corresponding output values (e.g., [scales:pal_area]scales::pal_area()).
name
The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.
breaks
One of: NULL for no breaks waiver() for the default breaks computed by the [scales:new_transform]transformation object A numeric vector of positions A function that takes the limits as input and returns breaks as output (e.g., a function returned by [scales:breaks_extended]scales::extended_breaks()). Note that for position scales, limits are provided after scale expansion. Also accepts rlang [rlang:as_function]lambda function notation.
labels
One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches. NULL for no labels waiver() for the default labels computed by the transformation object A character vector giving labels (must be same length as breaks) An expression vector (must be the same length as breaks). See ?plotmath for details. A function that takes the breaks as input and returns labels as output. Also accepts rlang [rlang:as_function]lambda function notation.
limits
One of: NULL to use the default scale range A numeric vector of length two providing limits of the scale. Use NA to refer to the existing minimum or maximum A function that accepts the existing (automatic) limits and returns new limits. Also accepts rlang [rlang:as_function]lambda function notation. Note that setting limits on positional scales will remove data outside of the limits. If the purpose is to zoom, use the limit argument in the coordinate system (see [=coord_cartesian]coord_cartesian()).
rescaler
A function used to scale the input values to the range [0, 1]. This is always [scales:rescale]scales::rescale(), except for diverging and n colour gradients (i.e., [=scale_colour_gradient2]scale_colour_gradient2(), [=scale_colour_gradientn]scale_colour_gradientn()). The rescaler is ignored by position scales, which always use [scales:rescale]scales::rescale(). Also accepts rlang [rlang:as_function]lambda function notation.
oob
One of: Function that handles limits outside of the scale limits (out of bounds). Also accepts rlang [rlang:as_function]lambda function notation. The default ([scales:oob]scales::squish()) squishes out of bounds values into range. [scales:oob]scales::censor for replacing out of bounds values with NA. [scales:oob]scales::squish_infinite() for squishing infinite values into range.
expand
For position scales, a vector of range expansion constants used to add some padding around the data to ensure that they are placed some distance away from the axes. Use the convenience function [=expansion]expansion() to generate the values for the expand argument. The defaults are to expand the scale by 5% on each side for continuous variables, and by 0.6 units on each side for discrete variables.
na.value
Missing values will be replaced with this value.
n.breaks
The number of break points to create if breaks are not given directly.
nice.breaks
Logical. Should breaks be attempted placed at nice values instead of exactly evenly spaced between the limits. If TRUE (default) the scale will ask the transformation object to create breaks, and this may result in a different number of breaks than requested. Ignored if breaks are given explicitly.
right
Should the intervals be closed on the right (TRUE, default) or should the intervals be closed on the left (FALSE)? 'Closed on the right' means that values at break positions are part of the lower bin (open on the left), whereas they are part of the upper bin when intervals are closed on the left (open on the right).
transform
For continuous scales, the name of a transformation object or the object itself. Built-in transformations include "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time". A transformation object bundles together a transform, its inverse, and methods for generating breaks and labels. Transformation objects are defined in the scales package, and are called transform_<name>. If transformations require arguments, you can call them from the scales package, e.g. [scales:transform_boxcox]scales::transform_boxcox(p = 2). You can create your own transformation with [scales:new_transform]scales::new_transform().
trans
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] Deprecated in favour of transform.
show.limits
should the limits of the scale appear as ticks
guide
A function used to create a guide or its name. See [=guides]guides() for more information.
position
For position scales, The position of the axis. left or right for y axes, top or bottom for x axes.
fallback.palette
Function to use when palette = NULL and the palette is not represented in the theme.
call
The call used to construct the scale for reporting messages.
super
The super class to use for the constructed scale
See also
The https://ggplot2-book.org/extensions#sec-new-scalesnew scales section of the online ggplot2 book.
calc_element
Calculate the element properties, by inheriting properties from its parents
CRAN · 4.0.3 · ggplot2/man/calc_element.Rd · 2026-05-07

Calculate the element properties, by inheriting properties from its parents

Aliases
calc_element
Keywords
internal
Usage
calc_element( element, theme, verbose = FALSE, skip_blank = FALSE, call = caller_env() )
Arguments
element
The name of the theme element to calculate
theme
A theme object (like [=theme_grey]theme_grey())
verbose
If TRUE, print out which elements this one inherits from
skip_blank
If TRUE, elements of type element_blank in the inheritance hierarchy will be ignored.
Examples
t <- theme_grey() calc_element('text', t) # Compare the "raw" element definition to the element with calculated inheritance t$axis.text.x calc_element('axis.text.x', t, verbose = TRUE) # This reports that axis.text.x inherits from axis.text, # which inherits from text. You can view each of them with: t$axis.text.x t$axis.text t$text
check_device
Check graphics device capabilities
CRAN · 4.0.3 · ggplot2/man/check_device.Rd · 2026-05-07

This function makes an attempt to estimate whether the graphics device is able to render newer graphics features.

Aliases
check_device
Keywords
internal
Usage
check_device( feature, action = "warn", op = NULL, maybe = FALSE, call = caller_env() )
Arguments
feature
A string naming a graphics device feature. One of: "clippingPaths", "alpha_masks", "lumi_masks", "compositing", "blending", "transformations", "gradients", "patterns", "paths" or "glyphs". See the 'Features' section below for an explanation of these terms.
action
A string for what action to take. One of: "test" returns TRUE or FALSE indicating support of the feature. "warn" also returns a logical, but throws an informative warning when FALSE. "abort" throws an error when the device is estimated to not support the feature.
op
A string for a specific operation to test for when feature is either "blending" or "compositing". If NULL (default), support for all known blending or compositing operations is queried.
maybe
A logical of length 1 determining what the return value should be in case the device capabilities cannot be assessed. When the current device is the 'null device', maybe is returned.
call
The execution environment of a currently running function, e.g. [rlang:stack]caller_env(). The function will be mentioned in warnings and error messages as the source of the warning or error. See the call argument of [rlang:abort]abort() for more information.
Details
The procedure for testing is as follows: First, the version is checked against the version wherein a feature was introduced. Next, the [grDevices:dev.capabilities]dev.capabilities() function is queried for support of the feature. If that check is ambiguous, the svglite and ragg devices are checked for known support. Lastly, if there is no answer yet, it is checked whether the device is one of the 'known' devices that supports a feature.
Value
TRUE when the feature is thought to be supported and FALSE otherwise.
Examples
# Typically you'd run `check_device()` inside a function that might produce # advanced graphics. # The check is designed for use in control flow statements in the test mode if (check_device("patterns", action = "test")) print("Yay") else print("Nay") # Automatically throw a warning when unavailable if (check_device("compositing", action = "warn")) print("Yay") else print("Nay") # Possibly throw an error try(check_device("glyphs", action = "abort"))
Custom sections
Features
"clippingPaths"While most devices support rectangular clipping regions, this feature is about the support for clipping to arbitrary paths. It can be used to only display a part of a drawing. "alpha_masks"Like clipping regions and paths, alpha masks can also be used to only display a part of a drawing. In particular a semi-transparent mask can be used to display a drawing in the opaque parts of the mask and hide a drawing in transparent part of a mask. "lumi_masksSimilar to alpha masks, but using the mask's luminance (greyscale value) to determine what is drawn. Light values are opaque and dark values are transparent. "compositing"Compositing allows one to control how to drawings are drawn in relation to one another. By default, one drawing is drawn 'over' the previous one, but other operators are possible, like 'clear', 'in' and 'out'. "blending"When placing one drawing atop of another, the blend mode determines how the colours of the drawings relate to one another. "transformations"Performing an affine transformation on a group can be used to translate, rotate, scale, shear and flip the drawing. "gradients"Gradients can be used to show a transition between two or more colours as a fill in a drawing. The checks expects both linear and radial gradients to be supported. "patterns"Patterns can be used to display a repeated, tiled drawing as a fill in another drawing. "paths"Contrary to 'paths' as polyline or polygon drawings, "paths" refers to the ability to fill and stroke collections of drawings. "glyphs"Refers to the advanced typesetting feature for controlling the appearance of individual glyphs.
Limitations
On Windows machines, bitmap devices such as png() or jpeg() default to type = "windows". At the time of writing, these don't support any new features, in contrast to type = "cairo", which does. Prior to version 4.2.0, the capabilities cannot be resolved and the value of the maybe argument is returned. With the exception of the ragg and svglite devices, if the device doesn't report their capabilities via [grDevices:dev.capabilities]dev.capabilities(), or the version is below 4.2.0, the maybe value is returned. Even though patterns and gradients where introduced in 4.1.0, they are considered unsupported because providing vectorised patterns and gradients was only introduced later in 4.2.0. When using the RStudio graphics device, the back end is assumed to be the next device on the list. This assumption is typically met by default, unless the device list is purposefully rearranged.
class_definitions
Class definitions
CRAN · 4.0.3 · data · ggplot2/man/class_definitions.Rd · 2026-05-07

The S7 object oriented programming system requires class definitions. Here, we provide definitions of classes that are home to ggplot2.

Aliases
class_definitionsclass_ggclass_ggprotoclass_scaleclass_guidesclass_guideclass_coordclass_facetclass_layerclass_layoutclass_scales_listclass_S3_ggclass_relclass_zero_grobclass_waiverclass_derive
Keywords
datasetsinternal
Custom sections
S7 classes
A general advice the S7 package gives is to name class definition objects the same as the class name, which then becomes the constructor for the class. The classes listed below deviate from that advice for historical reasons, because some constructors like ggplot() are also S3 generics with methods. The have the class_-prefix to indicate their role. class_ggplot is an S7 class used for objects generated by [=ggplot]ggplot(). class_ggplot_built is an S7 class used for objects generated by [=ggplot_build]ggplot_build(). class_mapping is an S7 class used for objects generated by [=aes]aes(). class_theme is an S7 class used for objects generated by [=theme]theme(). class_labels is an S7 class used for objects generated by [=labs]labs(). class_gg is an abstract S7 class to used invoke similar behaviour among ggplot objects.
Theme elements
The theme elements follow the advice of the S7 package that the class names are also the class definitions and constructors. element is an abstract S7 class used to invoke similar behaviour among theme element objects. element_blank is an S7 class for not drawing theme elements. element_rect is an S7 class for drawing rectangles. element_line is an S7 class for drawing lines. element_text is an S7 class for rendering text. element_polygon is an S7 class for drawing polygons. element_point is an S7 class for drawing points. element_geom is an S7 class holding geom defaults. margin is an S7 class for declaring margins.
ggproto classes
The ggproto classes are S3 classes of the type environment that form the backbone of most systems in ggplot2 and are in particular crucial to the extension system. class_ggproto is an S3 class used for the objects generated by [=ggproto]ggproto() which are of the type environment. class_scale is a subclass of class_ggproto and is more described in the Scale documentation. class_guides is a subclass of class_ggproto and is considered an internal class. class_guide is a subclass of class_ggproto and is more described in the Guide documentation. class_coord is a subclass of class_ggproto and is more described in the Coord documentation. class_facet is a subclass of class_ggproto and is more described in the Facet documentation. class_layer is a subclass of class_ggproto and is used for the objects generated by [=layer]layer(). The class itself is considered internal and is described in more detail in the Layer documentation. class_layout is a subclass of class_ggproto and is considered an internal class. It is described in more detail in the Layout documentation. class_scales_list is a subclass of class_ggproto and is considered an internal class.
S3 classes
Some simple classes remain S3, primarily because they aren't meant to be recycled into new classes. htmlhttps://lifecycle.r-lib.org/articles/stages.html#supersededlifecycle-superseded.svgoptions: alt='[Superseded]'[Superseded] class_S3_gg is a temporary S3 class until R 4.3.0 is the minimum supported version. It is exported and listed here for completeness, but its use is heavily discouraged. It is superseded by class_gg. class_rel is an S3 class used in element properties. class_zero_grob is an S3 class used to indicate empty drawings. class_waiver is an S3 sentinel value class used in various places. class_derive is an S3 sentinel value class used primarily in [=sec_axis]sec_axis().
class_ggplot
The ggplot class
CRAN · 4.0.3 · ggplot2/man/class_ggplot.Rd · 2026-05-07

The ggplot class collects the needed information to render a plot. This class can be constructed using the [=ggplot]ggplot() function.

Aliases
class_ggplot
Keywords
internal
Usage
class_ggplot( data = waiver(), ..., layers = list(), scales = NULL, guides = NULL, mapping = aes(), theme = NULL, coordinates = coord_cartesian(default = TRUE), facet = facet_null(), layout = NULL, labels = labs(), meta = list(), plot_env = parent.frame() )
Arguments
data
A property containing any data coerced by [=fortify]fortify().
...
Reserved for future expansion.
layers
A list of layer instances created by [=layer]layer().
scales
A ScalesList ggproto object.
guides
A Guides ggproto object created by [=guides]guides().
mapping
A mapping class object created by [=aes]aes().
theme
A theme class object created by [=theme]theme().
coordinates
A Coord ggproto object created by coord_*() family of functions.
facet
A Facet ggproto object created by facet_*() family of functions.
layout
A Layout ggproto object.
labels
A labels object created by [=labs]labs().
meta
A list for additional metadata. This will be deprecated in the future.
plot_env
An environment.
class_ggplot_built
The ggplot built class
CRAN · 4.0.3 · ggplot2/man/class_ggplot_built.Rd · 2026-05-07

The ggplot built class is an intermediate class and represents a processed ggplot object ready for rendering. It is constructed by calling [=ggplot_build]ggplot_build() on a [=class_ggplot]ggplot object and is not meant to be instantiated directly. The class can be rendered to a gtable object by calling the [=ggplot_gtable]ggplot_gtable() function on a ggplot built class object.

Aliases
class_ggplot_built
Keywords
internal
Usage
class_ggplot_built(..., data = NULL, layout = NULL, plot = NULL)
Arguments
...
Reserved for future expansion.
data
A list of plain data frames; one for each layer.
layout
A Layout ggproto object.
plot
A completed ggplot class object.
class_labels
The labels class
CRAN · 4.0.3 · ggplot2/man/class_labels.Rd · 2026-05-07

The labels class holds a list with label information to display as titles of plot components. The preferred way to construct an object of the labels class is to use the [=labs]labs() function.

Aliases
class_labels
Keywords
internal
Usage
class_labels(labels = list(), ...)
Arguments
labels
A named list.
...
Reserved for future expansion.
Details
All members of labels are expected to be named and names should be unique.
class_mapping
The mapping class
CRAN · 4.0.3 · ggplot2/man/class_mapping.Rd · 2026-05-07

The mapping class holds a list of quoted expressions ([rlang:topic-quosure]quosures) or constants. An object is typically constructed using the [=aes]aes() function.

Aliases
class_mapping
Keywords
internal
Usage
class_mapping(x = list(), ..., env = globalenv())
Arguments
x
A list of quosures and constants.
...
Reserved for future expansion.
env
An environment for symbols that are not quosures or constants.
class_theme
The theme class
CRAN · 4.0.3 · ggplot2/man/class_theme.Rd · 2026-05-07

The theme class holds information on how non-data elements of the plot should be rendered. The preferred way to construct an object of this class is through the [=theme]theme() function.

Aliases
class_theme
Keywords
internal
Usage
class_theme(elements = list(), ..., complete = FALSE, validate = TRUE)
Arguments
elements
A named list containing theme elements.
...
Reserved for future expansion.
complete
A boolean value stating whether a theme is complete.
validate
A boolean value stating whether a theme should still be validated.
combine_vars
Take input data and define a mapping between faceting variables and ROW, COL and PANEL keys
CRAN · 4.0.3 · ggplot2/man/combine_vars.Rd · 2026-05-07

Take input data and define a mapping between faceting variables and ROW, COL and PANEL keys

Aliases
combine_vars
Keywords
internal
Usage
combine_vars(data, env = emptyenv(), vars = NULL, drop = TRUE)
Arguments
data
A list of data.frames, the first being the plot data and the subsequent individual layer data
env
The environment the vars should be evaluated in
vars
A list of quoted symbols matching columns in data
drop
should missing combinations/levels be dropped
Value
A data.frame with columns for PANEL, ROW, COL, and faceting vars
complete_theme
Complete a theme
CRAN · 4.0.3 · ggplot2/man/complete_theme.Rd · 2026-05-07

This function takes a theme and completes it so that it can be used downstream to render theme elements. Missing elements are filled in and every item is validated to the specifications of the element tree.

Aliases
complete_theme
Keywords
internal
Usage
complete_theme(theme = NULL, default = theme_get())
Arguments
theme
An incomplete [=theme]theme object to complete, or NULL to complete the default theme.
default
A complete [=theme]theme to fill in missing pieces. Defaults to the global theme settings.
Value
A [=theme]theme object.
Examples
my_theme <- theme(line = element_line(colour = "red")) complete_theme(my_theme)
continuous_scale
Continuous scale constructor
CRAN · 4.0.3 · ggplot2/man/continuous_scale.Rd · 2026-05-07

Continuous scale constructor

Aliases
continuous_scale
Keywords
internal
Usage
continuous_scale( aesthetics, scale_name = deprecated(), palette, name = waiver(), breaks = waiver(), minor_breaks = waiver(), n.breaks = NULL, labels = waiver(), limits = NULL, rescaler = rescale, oob = censor, expand = waiver(), na.value = NA, transform = "identity", trans = deprecated(), guide = "legend", position = "left", fallback.palette = NULL, call = caller_call(), super = ScaleContinuous )
Arguments
aesthetics
The names of the aesthetics that this scale works with.
scale_name
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] The name of the scale that should be used for error messages associated with this scale.
palette
A palette function that when called with a numeric vector with values between 0 and 1 returns the corresponding output values (e.g., [scales:pal_area]scales::pal_area()).
name
The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.
breaks
One of: NULL for no breaks waiver() for the default breaks computed by the [scales:new_transform]transformation object A numeric vector of positions A function that takes the limits as input and returns breaks as output (e.g., a function returned by [scales:breaks_extended]scales::extended_breaks()). Note that for position scales, limits are provided after scale expansion. Also accepts rlang [rlang:as_function]lambda function notation.
minor_breaks
One of: NULL for no minor breaks waiver() for the default breaks (none for discrete, one minor break between each major break for continuous) A numeric vector of positions A function that given the limits returns a vector of minor breaks. Also accepts rlang [rlang:as_function]lambda function notation. When the function has two arguments, it will be given the limits and major break positions.
n.breaks
An integer guiding the number of major breaks. The algorithm may choose a slightly different number to ensure nice break labels. Will only have an effect if breaks = waiver(). Use NULL to use the default number of breaks given by the transformation.
labels
One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches. NULL for no labels waiver() for the default labels computed by the transformation object A character vector giving labels (must be same length as breaks) An expression vector (must be the same length as breaks). See ?plotmath for details. A function that takes the breaks as input and returns labels as output. Also accepts rlang [rlang:as_function]lambda function notation.
limits
One of: NULL to use the default scale range A numeric vector of length two providing limits of the scale. Use NA to refer to the existing minimum or maximum A function that accepts the existing (automatic) limits and returns new limits. Also accepts rlang [rlang:as_function]lambda function notation. Note that setting limits on positional scales will remove data outside of the limits. If the purpose is to zoom, use the limit argument in the coordinate system (see [=coord_cartesian]coord_cartesian()).
rescaler
A function used to scale the input values to the range [0, 1]. This is always [scales:rescale]scales::rescale(), except for diverging and n colour gradients (i.e., [=scale_colour_gradient2]scale_colour_gradient2(), [=scale_colour_gradientn]scale_colour_gradientn()). The rescaler is ignored by position scales, which always use [scales:rescale]scales::rescale(). Also accepts rlang [rlang:as_function]lambda function notation.
oob
One of: Function that handles limits outside of the scale limits (out of bounds). Also accepts rlang [rlang:as_function]lambda function notation. The default ([scales:oob]scales::censor()) replaces out of bounds values with NA. [scales:oob]scales::squish() for squishing out of bounds values into range. [scales:oob]scales::squish_infinite() for squishing infinite values into range.
expand
For position scales, a vector of range expansion constants used to add some padding around the data to ensure that they are placed some distance away from the axes. Use the convenience function [=expansion]expansion() to generate the values for the expand argument. The defaults are to expand the scale by 5% on each side for continuous variables, and by 0.6 units on each side for discrete variables.
na.value
Missing values will be replaced with this value.
transform
For continuous scales, the name of a transformation object or the object itself. Built-in transformations include "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time". A transformation object bundles together a transform, its inverse, and methods for generating breaks and labels. Transformation objects are defined in the scales package, and are called transform_<name>. If transformations require arguments, you can call them from the scales package, e.g. [scales:transform_boxcox]scales::transform_boxcox(p = 2). You can create your own transformation with [scales:new_transform]scales::new_transform().
trans
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] Deprecated in favour of transform.
guide
A function used to create a guide or its name. See [=guides]guides() for more information.
position
For position scales, The position of the axis. left or right for y axes, top or bottom for x axes.
fallback.palette
Function to use when palette = NULL and the palette is not represented in the theme.
call
The call used to construct the scale for reporting messages.
super
The super class to use for the constructed scale
See also
The https://ggplot2-book.org/extensions#sec-new-scalesnew scales section of the online ggplot2 book.
coord_cartesian
Cartesian coordinates
CRAN · 4.0.3 · ggplot2/man/coord_cartesian.Rd · 2026-05-07

The Cartesian coordinate system is the most familiar, and common, type of coordinate system. Setting limits on the coordinate system will zoom the plot (like you're looking at it with a magnifying glass), and will not change the underlying data like setting limits on a scale will.

Aliases
coord_cartesian
Usage
coord_cartesian( xlim = NULL, ylim = NULL, expand = TRUE, default = FALSE, clip = "on", reverse = "none", ratio = NULL )
Arguments
xlim, ylim
Limits for the x and y axes.
expand
If TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim. Giving a logical vector will separately control the expansion for the four directions (top, left, bottom and right). The expand argument will be recycled to length 4 if necessary. Alternatively, can be a named logical vector to control a single direction, e.g. expand = c(bottom = FALSE).
default
Is this the default coordinate system? If FALSE (the default), then replacing this coordinate system with another one creates a message alerting the user that the coordinate system is being replaced. If TRUE, that warning is suppressed.
clip
Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. In most cases, the default of "on" should not be changed, as setting clip = "off" can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via xlim and ylim and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins.
reverse
A string giving which directions to reverse. "none" (default) keeps directions as is. "x" and "y" can be used to reverse their respective directions. "xy" can be used to reverse both directions.
ratio
aspect ratio, expressed as y / x. Can be NULL (default) to not use an aspect ratio. Using 1 ensures that one unit on the x-axis is the same length as one unit on the y-axis. Ratios higher than one make units on the y-axis longer than units on the x-axis, and vice versa.
Examples
# There are two ways of zooming the plot display: with scales or # with coordinate systems. They work in two rather different ways. p <- ggplot(mtcars, aes(disp, wt)) + geom_point() + geom_smooth() p # Setting the limits on a scale converts all values outside the range to NA. p + scale_x_continuous(limits = c(325, 500)) # Setting the limits on the coordinate system performs a visual zoom. # The data is unchanged, and we just view a small portion of the original # plot. Note how smooth continues past the points visible on this plot. p + coord_cartesian(xlim = c(325, 500)) # By default, the same expansion factor is applied as when setting scale # limits. You can set the limits precisely by setting expand = FALSE p + coord_cartesian(xlim = c(325, 500), expand = FALSE) # Similarly, we can use expand = FALSE to turn off expansion with the # default limits p + coord_cartesian(expand = FALSE) # Using a fixed ratio: 1 y-axis unit is 100 x-axis units # Plot window can be resized and aspect ratio will be maintained p + coord_cartesian(ratio = 100) # You can see the same thing with this 2d histogram d <- ggplot(diamonds, aes(carat, price)) + stat_bin_2d(bins = 25, colour = "white") d # When zooming the scale, the we get 25 new bins that are the same # size on the plot, but represent smaller regions of the data space d + scale_x_continuous(limits = c(0, 1)) # When zooming the coordinate system, we see a subset of original 50 bins, # displayed bigger d + coord_cartesian(xlim = c(0, 1))
coord_fixed
Cartesian coordinates with fixed "aspect ratio"
CRAN · 4.0.3 · ggplot2/man/coord_fixed.Rd · 2026-05-07

A fixed scale coordinate system forces a specified ratio between the physical representation of data units on the axes. The ratio represents the number of units on the y-axis equivalent to one unit on the x-axis. The default, ratio = 1, ensures that one unit on the x-axis is the same length as one unit on the y-axis. Ratios higher than one make units on the y axis longer than units on the x-axis, and vice versa. This is similar to [MASS:eqscplot]MASS::eqscplot(), but it works for all types of graphics.

Aliases
coord_fixedcoord_equal
Usage
coord_fixed(ratio = 1, ...)
Arguments
ratio
aspect ratio, expressed as y / x. Can be NULL (default) to not use an aspect ratio. Using 1 ensures that one unit on the x-axis is the same length as one unit on the y-axis. Ratios higher than one make units on the y-axis longer than units on the x-axis, and vice versa.
...
Arguments passed on to [=coord_cartesian]coord_cartesian xlim,ylimLimits for the x and y axes. expandIf TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim. Giving a logical vector will separately control the expansion for the four directions (top, left, bottom and right). The expand argument will be recycled to length 4 if necessary. Alternatively, can be a named logical vector to control a single direction, e.g. expand = c(bottom = FALSE). defaultIs this the default coordinate system? If FALSE (the default), then replacing this coordinate system with another one creates a message alerting the user that the coordinate system is being replaced. If TRUE, that warning is suppressed. clipShould drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. In most cases, the default of "on" should not be changed, as setting clip = "off" can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via xlim and ylim and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins. reverseA string giving which directions to reverse. "none" (default) keeps directions as is. "x" and "y" can be used to reverse their respective directions. "xy" can be used to reverse both directions.
Examples
# ensures that the ranges of axes are equal to the specified ratio by # adjusting the plot aspect ratio p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p + coord_fixed(ratio = 1) p + coord_fixed(ratio = 5) p + coord_fixed(ratio = 1/5) p + coord_fixed(xlim = c(15, 30)) # Resize the plot to see that the specified aspect ratio is maintained
coord_flip
Cartesian coordinates with x and y flipped
CRAN · 4.0.3 · ggplot2/man/coord_flip.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#supersededlifecycle-superseded.svgoptions: alt='[Superseded]'[Superseded] This function is superseded because in many cases, coord_flip() can easily be replaced by swapping the x and y aesthetics, or optionally setting the orientation argument in geom and stat layers. coord_flip() is useful for geoms and statistics that do not support the orientation setting, and converting the display of y conditional on x, to x conditional on y.

Aliases
coord_flip
Usage
coord_flip(xlim = NULL, ylim = NULL, expand = TRUE, clip = "on")
Arguments
xlim, ylim
Limits for the x and y axes.
expand
If TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim. Giving a logical vector will separately control the expansion for the four directions (top, left, bottom and right). The expand argument will be recycled to length 4 if necessary. Alternatively, can be a named logical vector to control a single direction, e.g. expand = c(bottom = FALSE).
clip
Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. In most cases, the default of "on" should not be changed, as setting clip = "off" can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via xlim and ylim and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins.
Details
Coordinate systems interact with many parts of the plotting system. You can expect the following for coord_flip(): It does not change the facet order in facet_grid() or facet_wrap(). The scale_x_*() functions apply to the vertical direction, whereas scale_y_*() functions apply to the horizontal direction. The same holds for the xlim and ylim arguments of coord_flip() and the xlim() and ylim() functions. The x-axis theme settings, such as axis.line.x apply to the horizontal direction. The y-axis theme settings, such as axis.text.y apply to the vertical direction.
Examples
# The preferred method of creating horizontal instead of vertical boxplots ggplot(diamonds, aes(price, cut)) + geom_boxplot() # Using `coord_flip()` to make the same plot ggplot(diamonds, aes(cut, price)) + geom_boxplot() + coord_flip() # With swapped aesthetics, the y-scale controls the left axis ggplot(diamonds, aes(y = carat)) + geom_histogram() + scale_y_reverse() # In `coord_flip()`, the x-scale controls the left axis ggplot(diamonds, aes(carat)) + geom_histogram() + coord_flip() + scale_x_reverse() # In line and area plots, swapped aesthetics require an explicit orientation df <- data.frame(a = 1:5, b = (1:5) ^ 2) ggplot(df, aes(b, a)) + geom_area(orientation = "y") # The same plot with `coord_flip()` ggplot(df, aes(a, b)) + geom_area() + coord_flip()
coord_map
Map projections
CRAN · 4.0.3 · ggplot2/man/coord_map.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#supersededlifecycle-superseded.svgoptions: alt='[Superseded]'[Superseded] coord_map() projects a portion of the earth, which is approximately spherical, onto a flat 2D plane using any projection defined by the mapproj package. Map projections do not, in general, preserve straight lines, so this requires considerable computation. coord_quickmap() is a quick approximation that does preserve straight lines. It works best for smaller areas closer to the equator. Both coord_map() and coord_quickmap() are superseded by [=coord_sf]coord_sf(), and should no longer be used in new code. All regular (non-sf) geoms can be used with coord_sf() by setting the default coordinate system via the default_crs argument. See also the examples for [=annotation_map]annotation_map() and [=geom_map]geom_map().

Aliases
coord_mapcoord_quickmap
Usage
coord_map( projection = "mercator", ..., parameters = NULL, orientation = NULL, xlim = NULL, ylim = NULL, clip = "on" ) coord_quickmap(xlim = NULL, ylim = NULL, expand = TRUE, clip = "on")
Arguments
projection
projection to use, see [mapproj:mapproject]mapproj::mapproject() for list
..., parameters
Other arguments passed on to [mapproj:mapproject]mapproj::mapproject(). Use ... for named parameters to the projection, and parameters for unnamed parameters. ... is ignored if the parameters argument is present.
orientation
projection orientation, which defaults to c(90, 0, mean(range(x))). This is not optimal for many projections, so you will have to supply your own. See [mapproj:mapproject]mapproj::mapproject() for more information.
xlim, ylim
Manually specific x/y limits (in degrees of longitude/latitude)
clip
Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. For details, please see [=coord_cartesian]coord_cartesian().
expand
If TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim. Giving a logical vector will separately control the expansion for the four directions (top, left, bottom and right). The expand argument will be recycled to length 4 if necessary. Alternatively, can be a named logical vector to control a single direction, e.g. expand = c(bottom = FALSE).
Details
Map projections must account for the fact that the actual length (in km) of one degree of longitude varies between the equator and the pole. Near the equator, the ratio between the lengths of one degree of latitude and one degree of longitude is approximately 1. Near the pole, it tends towards infinity because the length of one degree of longitude tends towards 0. For regions that span only a few degrees and are not too close to the poles, setting the aspect ratio of the plot to the appropriate lat/lon ratio approximates the usual mercator projection. This is what coord_quickmap() does, and is much faster (particularly for complex plots like [=geom_tile]geom_tile()) at the expense of correctness.
Examples
if (require("maps")) nz <- map_data("nz") # Prepare a map of NZ nzmap <- ggplot(nz, aes(x = long, y = lat, group = group)) + geom_polygon(fill = "white", colour = "black") # Plot it in cartesian coordinates nzmap if (require("maps")) # With correct mercator projection nzmap + coord_map() if (require("maps")) # With the aspect ratio approximation nzmap + coord_quickmap() if (require("maps")) # Other projections nzmap + coord_map("azequalarea", orientation = c(-36.92, 174.6, 0)) if (require("maps")) states <- map_data("state") usamap <- ggplot(states, aes(long, lat, group = group)) + geom_polygon(fill = "white", colour = "black") # Use cartesian coordinates usamap if (require("maps")) # With mercator projection usamap + coord_map() if (require("maps")) # See ?mapproject for coordinate systems and their parameters usamap + coord_map("gilbert") if (require("maps")) # For most projections, you'll need to set the orientation yourself # as the automatic selection done by mapproject is not available to # ggplot usamap + coord_map("orthographic") if (require("maps")) usamap + coord_map("conic", lat0 = 30) if (require("maps")) usamap + coord_map("bonne", lat0 = 50) if (require("maps")) # World map, using geom_path instead of geom_polygon world <- map_data("world") worldmap <- ggplot(world, aes(x = long, y = lat, group = group)) + geom_path() + scale_y_continuous(breaks = (-2:2) * 30) + scale_x_continuous(breaks = (-4:4) * 45) # Orthographic projection with default orientation (looking down at North pole) worldmap + coord_map("ortho") if (require("maps")) # Looking up up at South Pole worldmap + coord_map("ortho", orientation = c(-90, 0, 0)) if (require("maps")) # Centered on New York (currently has issues with closing polygons) worldmap + coord_map("ortho", orientation = c(41, -74, 0))
See also
The https://ggplot2-book.org/maps#sec-polygonmapspolygon maps section of the online ggplot2 book.
coord_munch
Munch coordinates data
CRAN · 4.0.3 · ggplot2/man/coord_munch.Rd · 2026-05-07

This function "munches" lines, dividing each line into many small pieces so they can be transformed independently. Used inside geom functions.

Aliases
coord_munch
Keywords
internal
Usage
coord_munch(coord, data, range, segment_length = 0.01, is_closed = FALSE)
Arguments
coord
Coordinate system definition.
data
Data set to transform - should have variables x and y are chopped up into small pieces (as defined by group). All other variables are duplicated as needed.
range
Panel range specification.
segment_length
Target segment length
is_closed
Whether data should be considered as a closed polygon.
coord_polar
Polar coordinates
CRAN · 4.0.3 · ggplot2/man/coord_radial.Rd · 2026-05-07

The polar coordinate system is most commonly used for pie charts, which are a stacked bar chart in polar coordinates. htmlhttps://lifecycle.r-lib.org/articles/stages.html#supersededlifecycle-superseded.svgoptions: alt='[Superseded]'[Superseded]: coord_polar() has been in favour of coord_radial().

Aliases
coord_polarcoord_radial
Usage
coord_polar(theta = "x", start = 0, direction = 1, clip = "on") coord_radial( theta = "x", start = 0, end = NULL, thetalim = NULL, rlim = NULL, expand = TRUE, direction = deprecated(), clip = "off", r.axis.inside = NULL, rotate.angle = FALSE, inner.radius = 0, reverse = "none", r_axis_inside = deprecated(), rotate_angle = deprecated() )
Arguments
theta
variable to map angle to (x or y)
start
Offset of starting point from 12 o'clock in radians. Offset is applied clockwise or anticlockwise depending on value of direction.
direction
1, clockwise; -1, anticlockwise
clip
Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. For details, please see [=coord_cartesian]coord_cartesian().
end
Position from 12 o'clock in radians where plot ends, to allow for partial polar coordinates. The default, NULL, is set to start + 2 * pi.
thetalim, rlim
Limits for the theta and r axes.
expand
If TRUE, the default, adds a small expansion factor to the limits to prevent overlap between data and axes. If FALSE, limits are taken directly from the scale.
r.axis.inside
One of the following: NULL (default) places the axis next to the panel if start and end arguments form a full circle and inside the panel otherwise. TRUE to place the radius axis inside the panel. FALSE to place the radius axis next to the panel. A numeric value, setting a theta axis value at which the axis should be placed inside the panel. Can be given as a length 2 vector to control primary and secondary axis placement separately.
rotate.angle
If TRUE, transforms the angle aesthetic in data in accordance with the computed theta position. If FALSE (default), no such transformation is performed. Can be useful to rotate text geoms in alignment with the coordinates.
inner.radius
A numeric between 0 and 1 setting the size of a inner radius hole.
reverse
A string giving which directions to reverse. "none" (default) keep directions as is. "theta" reverses the angle and "r" reverses the radius. "thetar" reverses both the angle and the radius.
r_axis_inside, rotate_angle
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated]
Examples
# NOTE: Use these plots with caution - polar coordinates has # major perceptual problems. The main point of these examples is # to demonstrate how these common plots can be described in the # grammar. Use with EXTREME caution. # A pie chart = stacked bar chart + polar coordinates pie <- ggplot(mtcars, aes(x = factor(1), fill = factor(cyl))) + geom_bar(width = 1) pie + coord_radial(theta = "y", expand = FALSE) # A coxcomb plot = bar chart + polar coordinates cxc <- ggplot(mtcars, aes(x = factor(cyl))) + geom_bar(width = 1, colour = "black") cxc + coord_radial(expand = FALSE) # A new type of plot? cxc + coord_radial(theta = "y", expand = FALSE) # The bullseye chart pie + coord_radial(expand = FALSE) # Hadley's favourite pie chart df <- data.frame( variable = c("does not resemble", "resembles"), value = c(20, 80) ) ggplot(df, aes(x = "", y = value, fill = variable)) + geom_col(width = 1) + scale_fill_manual(values = c("red", "yellow")) + coord_radial("y", start = pi / 3, expand = FALSE) + labs(title = "Pac man") # Windrose + doughnut plot if (require("ggplot2movies")) movies$rrating <- cut_interval(movies$rating, length = 1) movies$budgetq <- cut_number(movies$budget, 4) doh <- ggplot(movies, aes(x = rrating, fill = budgetq)) # Wind rose doh + geom_bar(width = 1) + coord_radial(expand = FALSE) # Race track plot doh + geom_bar(width = 0.9, position = "fill") + coord_radial(theta = "y", expand = FALSE) # A partial polar plot ggplot(mtcars, aes(disp, mpg)) + geom_point() + coord_radial(start = -0.4 * pi, end = 0.4 * pi, inner.radius = 0.3) # Similar with coord_cartesian(), you can set limits. ggplot(mtcars, aes(disp, mpg)) + geom_point() + coord_radial( start = -0.4 * pi, end = 0.4 * pi, inner.radius = 0.3, thetalim = c(200, 300), rlim = c(15, 30), )
See also
The https://ggplot2-book.org/coord#polar-coordinates-with-coord_polarpolar coordinates section of the online ggplot2 book.
Note
In coord_radial(), position guides can be defined by using guides(r = ..., theta = ..., r.sec = ..., theta.sec = ...). Note that these guides require r and theta as available aesthetics. The classic [=guide_axis]guide_axis() can be used for the r positions and [=guide_axis_theta]guide_axis_theta() can be used for the theta positions. Using the theta.sec position is only sensible when inner.radius > 0.
coord_transform
Transformed Cartesian coordinate system
CRAN · 4.0.3 · ggplot2/man/coord_transform.Rd · 2026-05-07

coord_transform() is different to scale transformations in that it occurs after statistical transformation and will affect the visual appearance of geoms - there is no guarantee that straight lines will continue to be straight.

Aliases
coord_transformcoord_trans
Usage
coord_transform( x = "identity", y = "identity", xlim = NULL, ylim = NULL, limx = deprecated(), limy = deprecated(), clip = "on", expand = TRUE, reverse = "none" ) coord_trans(...)
Arguments
x, y
Transformers for x and y axes or their names.
xlim, ylim
Limits for the x and y axes.
limx, limy
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] use xlim and ylim instead.
clip
Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. In most cases, the default of "on" should not be changed, as setting clip = "off" can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via xlim and ylim and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins.
expand
If TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim. Giving a logical vector will separately control the expansion for the four directions (top, left, bottom and right). The expand argument will be recycled to length 4 if necessary. Alternatively, can be a named logical vector to control a single direction, e.g. expand = c(bottom = FALSE).
reverse
A string giving which directions to reverse. "none" (default) keeps directions as is. "x" and "y" can be used to reverse their respective directions. "xy" can be used to reverse both directions.
...
Arguments forwarded to coord_transform().
Details
Transformations only work with continuous values: see [scales:new_transform]scales::new_transform() for list of transformations, and instructions on how to create your own. The coord_trans() function is deprecated in favour of coord_transform().
Examples
# See ?geom_boxplot for other examples # Three ways of doing transformation in ggplot: # * by transforming the data ggplot(diamonds, aes(log10(carat), log10(price))) + geom_point() # * by transforming the scales ggplot(diamonds, aes(carat, price)) + geom_point() + scale_x_log10() + scale_y_log10() # * by transforming the coordinate system: ggplot(diamonds, aes(carat, price)) + geom_point() + coord_transform(x = "log10", y = "log10") # The difference between transforming the scales and # transforming the coordinate system is that scale # transformation occurs BEFORE statistics, and coordinate # transformation afterwards. Coordinate transformation also # changes the shape of geoms: d <- subset(diamonds, carat > 0.5) ggplot(d, aes(carat, price)) + geom_point() + geom_smooth(method = "lm") + scale_x_log10() + scale_y_log10() ggplot(d, aes(carat, price)) + geom_point() + geom_smooth(method = "lm") + coord_transform(x = "log10", y = "log10") # Here I used a subset of diamonds so that the smoothed line didn't # drop below zero, which obviously causes problems on the log-transformed # scale # With a combination of scale and coordinate transformation, it's # possible to do back-transformations: ggplot(diamonds, aes(carat, price)) + geom_point() + geom_smooth(method = "lm") + scale_x_log10() + scale_y_log10() + coord_transform(x = scales::transform_exp(10), y = scales::transform_exp(10)) # cf. ggplot(diamonds, aes(carat, price)) + geom_point() + geom_smooth(method = "lm") # Also works with discrete scales set.seed(1) df <- data.frame(a = abs(rnorm(26)),letters) plot <- ggplot(df,aes(a,letters)) + geom_point() plot + coord_transform(x = "log10") plot + coord_transform(x = "sqrt")
See also
The https://ggplot2-book.org/coord#transformations-with-coord_transcoord transformations section of the online ggplot2 book.
cut_interval
Discretise numeric data into categorical
CRAN · 4.0.3 · ggplot2/man/cut_interval.Rd · 2026-05-07

cut_interval() makes n groups with equal range, cut_number() makes n groups with (approximately) equal numbers of observations; cut_width() makes groups of width width.

Aliases
cut_intervalcut_numbercut_width
Usage
cut_interval(x, n = NULL, length = NULL, ...) cut_number(x, n = NULL, ...) cut_width(x, width, center = NULL, boundary = NULL, closed = "right", ...)
Arguments
x
numeric vector
n
number of intervals to create, OR
length
length of each interval
...
Arguments passed on to [base:cut]base::cut.default breakseither a numeric vector of two or more unique cut points or a single number (greater than or equal to 2) giving the number of intervals into which x is to be cut. labelslabels for the levels of the resulting category. By default, labels are constructed using "(a,b]" interval notation. If labels = FALSE, simple integer codes are returned instead of a factor. rightlogical, indicating if the intervals should be closed on the right (and open on the left) or vice versa. dig.labinteger which is used when labels are not given. It determines the number of digits used in formatting the break numbers. ordered_resultlogical: should the result be an ordered factor?
width
The bin width.
center, boundary
Specify either the position of edge or the center of a bin. Since all bins are aligned, specifying the position of a single bin (which doesn't need to be in the range of the data) affects the location of all bins. If not specified, uses the "tile layers algorithm", and sets the boundary to half of the binwidth. To center on integers, width = 1 and center = 0. boundary = 0.5.
closed
One of "right" or "left" indicating whether right or left edges of bins are included in the bin.
Examples
table(cut_interval(1:100, 10)) table(cut_interval(1:100, 11)) set.seed(1) table(cut_number(runif(1000), 10)) table(cut_width(runif(1000), 0.1)) table(cut_width(runif(1000), 0.1, boundary = 0)) table(cut_width(runif(1000), 0.1, center = 0)) table(cut_width(runif(1000), 0.1, labels = FALSE))
Author
Randall Prium contributed most of the implementation of cut_width().
datetime_scale
Date/time scale constructor
CRAN · 4.0.3 · ggplot2/man/datetime_scale.Rd · 2026-05-07

Date/time scale constructor

Aliases
datetime_scale
Keywords
internal
Usage
datetime_scale( aesthetics, transform, trans = deprecated(), palette, breaks = pretty_breaks(), minor_breaks = waiver(), labels = waiver(), date_breaks = waiver(), date_labels = waiver(), date_minor_breaks = waiver(), timezone = NULL, guide = "legend", call = caller_call(), ... )
Arguments
aesthetics
The names of the aesthetics that this scale works with.
transform
For continuous scales, the name of a transformation object or the object itself. Built-in transformations include "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time". A transformation object bundles together a transform, its inverse, and methods for generating breaks and labels. Transformation objects are defined in the scales package, and are called transform_<name>. If transformations require arguments, you can call them from the scales package, e.g. [scales:transform_boxcox]scales::transform_boxcox(p = 2). You can create your own transformation with [scales:new_transform]scales::new_transform().
trans
For date/time scales, the name of a date/time transformation or the object itself. Built-in transformations include "hms", "date" and "time".
palette
A palette function that when called with a numeric vector with values between 0 and 1 returns the corresponding output values (e.g., [scales:pal_area]scales::pal_area()).
breaks
One of: NULL for no breaks waiver() for the breaks specified by date_breaks A Date/POSIXct vector giving positions of breaks A function that takes the limits as input and returns breaks as output
minor_breaks
One of: NULL for no breaks waiver() for the breaks specified by date_minor_breaks A Date/POSIXct vector giving positions of minor breaks A function that takes the limits as input and returns minor breaks as output
labels
One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches. NULL for no labels waiver() for the default labels computed by the transformation object A character vector giving labels (must be same length as breaks) An expression vector (must be the same length as breaks). See ?plotmath for details. A function that takes the breaks as input and returns labels as output. Also accepts rlang [rlang:as_function]lambda function notation.
date_breaks
A string giving the distance between breaks like "2 weeks", or "10 years". If both breaks and date_breaks are specified, date_breaks wins. Valid specifications are 'sec', 'min', 'hour', 'day', 'week', 'month' or 'year', optionally followed by 's'.
date_labels
A string giving the formatting specification for the labels. Codes are defined in [=strftime]strftime(). If both labels and date_labels are specified, date_labels wins.
date_minor_breaks
A string giving the distance between minor breaks like "2 weeks", or "10 years". If both minor_breaks and date_minor_breaks are specified, date_minor_breaks wins. Valid specifications are 'sec', 'min', 'hour', 'day', 'week', 'month' or 'year', optionally followed by 's'.
timezone
The timezone to use for display on the axes. The default (NULL) uses the timezone encoded in the data.
guide
A function used to create a guide or its name. See [=guides]guides() for more information.
call
The call used to construct the scale for reporting messages.
...
Arguments passed on to [=continuous_scale]continuous_scale scale_namehtmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] The name of the scale that should be used for error messages associated with this scale. nameThe name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted. n.breaksAn integer guiding the number of major breaks. The algorithm may choose a slightly different number to ensure nice break labels. Will only have an effect if breaks = waiver(). Use NULL to use the default number of breaks given by the transformation. limitsOne of: NULL to use the default scale range A numeric vector of length two providing limits of the scale. Use NA to refer to the existing minimum or maximum A function that accepts the existing (automatic) limits and returns new limits. Also accepts rlang [rlang:as_function]lambda function notation. Note that setting limits on positional scales will remove data outside of the limits. If the purpose is to zoom, use the limit argument in the coordinate system (see [=coord_cartesian]coord_cartesian()). rescalerA function used to scale the input values to the range [0, 1]. This is always [scales:rescale]scales::rescale(), except for diverging and n colour gradients (i.e., [=scale_colour_gradient2]scale_colour_gradient2(), [=scale_colour_gradientn]scale_colour_gradientn()). The rescaler is ignored by position scales, which always use [scales:rescale]scales::rescale(). Also accepts rlang [rlang:as_function]lambda function notation. oobOne of: Function that handles limits outside of the scale limits (out of bounds). Also accepts rlang [rlang:as_function]lambda function notation. The default ([scales:oob]scales::censor()) replaces out of bounds values with NA. [scales:oob]scales::squish() for squishing out of bounds values into ra
diamonds
Prices of over 50,000 round cut diamonds
CRAN · 4.0.3 · data · ggplot2/man/diamonds.Rd · 2026-05-07

A dataset containing the prices and other attributes of almost 54,000 diamonds. The variables are as follows:

Aliases
diamonds
Keywords
datasets
Usage
diamonds
Format
A data frame with 53940 rows and 10 variables: priceprice in US dollars ($326--$18,823) caratweight of the diamond (0.2--5.01) cutquality of the cut (Fair, Good, Very Good, Premium, Ideal) colordiamond colour, from D (best) to J (worst) claritya measurement of how clear the diamond is (I1 (worst), SI2, SI1, VS2, VS1, VVS2, VVS1, IF (best)) xlength in mm (0--10.74) ywidth in mm (0--58.9) zdepth in mm (0--31.8) depthtotal depth percentage = z / mean(x, y) = 2 * z / (x + y) (43--79) tablewidth of top of diamond relative to widest point (43--95)
discrete_scale
Discrete scale constructor
CRAN · 4.0.3 · ggplot2/man/discrete_scale.Rd · 2026-05-07

Discrete scale constructor

Aliases
discrete_scale
Keywords
internal
Usage
discrete_scale( aesthetics, scale_name = deprecated(), palette, name = waiver(), breaks = waiver(), minor_breaks = waiver(), labels = waiver(), limits = NULL, expand = waiver(), na.translate = TRUE, na.value = NA, drop = TRUE, guide = "legend", position = "left", fallback.palette = NULL, call = caller_call(), super = ScaleDiscrete )
Arguments
aesthetics
The names of the aesthetics that this scale works with.
scale_name
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] The name of the scale that should be used for error messages associated with this scale.
palette
A palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take (e.g., [scales:pal_hue]scales::pal_hue()).
name
The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.
breaks
One of: NULL for no breaks waiver() for the default breaks (the scale limits) A character vector of breaks A function that takes the limits as input and returns breaks as output. Also accepts rlang [rlang:as_function]lambda function notation.
minor_breaks
One of: NULL for no minor breaks waiver() for the default breaks (none for discrete, one minor break between each major break for continuous) A numeric vector of positions A function that given the limits returns a vector of minor breaks. Also accepts rlang [rlang:as_function]lambda function notation. When the function has two arguments, it will be given the limits and major break positions.
labels
One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches. NULL for no labels waiver() for the default labels computed by the transformation object A character vector giving labels (must be same length as breaks) An expression vector (must be the same length as breaks). See ?plotmath for details. A function that takes the breaks as input and returns labels as output. Also accepts rlang [rlang:as_function]lambda function notation.
limits
One of: NULL to use the default scale values A character vector that defines possible values of the scale and their order A function that accepts the existing (automatic) values and returns new ones. Also accepts rlang [rlang:as_function]lambda function notation.
expand
For position scales, a vector of range expansion constants used to add some padding around the data to ensure that they are placed some distance away from the axes. Use the convenience function [=expansion]expansion() to generate the values for the expand argument. The defaults are to expand the scale by 5% on each side for continuous variables, and by 0.6 units on each side for discrete variables.
na.translate
Unlike continuous scales, discrete scales can easily show missing values, and do so by default. If you want to remove missing values from a discrete scale, specify na.translate = FALSE.
na.value
If na.translate = TRUE, what aesthetic value should the missing values be displayed as? Does not apply to position scales where NA is always placed at the far right.
drop
Should unused factor levels be omitted from the scale? The default, TRUE, uses the levels that appear in the data; FALSE includes the levels in the factor. Please note that to display every level in a legend, the layer should use show.legend = TRUE.
guide
A function used to create a guide or its name. See [=guides]guides() for more information.
position
For position scales, The position of the axis. left or right for y axes, top or bottom for x axes.
fallback.palette
Function to use when palette = NULL and the palette is not represented in the theme.
call
The call used to construct the scale for reporting messages.
super
The super class to use for the constructed scale
See also
The https://ggplot2-book.org/extensions#sec-new-scalesnew scales section of the online ggplot2 book.
draw_key
Key glyphs for legends
CRAN · 4.0.3 · ggplot2/man/draw_key.Rd · 2026-05-07

Each geom has an associated function that draws the key when the geom needs to be displayed in a legend. These functions are called draw_key_*(), where * stands for the name of the respective key glyph. The key glyphs can be customized for individual geoms by providing a geom with the key_glyph argument (see [=layer]layer() or examples below.)

Aliases
draw_keydraw_key_pointdraw_key_ablinedraw_key_rectdraw_key_polygondraw_key_blankdraw_key_boxplotdraw_key_crossbardraw_key_pathdraw_key_vpathdraw_key_dotplotdraw_key_linerangedraw_key_pointrangedraw_key_smoothdraw_key_textdraw_key_labeldraw_key_vlinedraw_key_timeseries
Usage
draw_key_point(data, params, size) draw_key_abline(data, params, size) draw_key_rect(data, params, size) draw_key_polygon(data, params, size) draw_key_blank(data, params, size) draw_key_boxplot(data, params, size) draw_key_crossbar(data, params, size) draw_key_path(data, params, size) draw_key_vpath(data, params, size) draw_key_dotplot(data, params, size) draw_key_linerange(data, params, size) draw_key_pointrange(data, params, size) draw_key_smooth(data, params, size) draw_key_text(data, params, size) draw_key_label(data, params, size) draw_key_vline(data, params, size) draw_key_timeseries(data, params, size)
Arguments
data
A single row data frame containing the scaled aesthetics to display in this key
params
A list of additional parameters supplied to the geom.
size
Width and height of key in mm.
Value
A grid grob.
Examples
p <- ggplot(economics, aes(date, psavert, color = "savings rate")) # key glyphs can be specified by their name p + geom_line(key_glyph = "timeseries") # key glyphs can be specified via their drawing function p + geom_line(key_glyph = draw_key_rect)
economics
US economic time series
CRAN · 4.0.3 · data · ggplot2/man/economics.Rd · 2026-05-07

This dataset was produced from US economic time series data available from https://fred.stlouisfed.org/. economics is in "wide" format, economics_long is in "long" format.

Aliases
economicseconomics_long
Keywords
datasets
Usage
economics economics_long
Format
A data frame with 574 rows and 6 variables: dateMonth of data collection pcepersonal consumption expenditures, in billions of dollars, https://fred.stlouisfed.org/series/PCE poptotal population, in thousands, https://fred.stlouisfed.org/series/POP psavertpersonal savings rate, https://fred.stlouisfed.org/series/PSAVERT/ uempmedmedian duration of unemployment, in weeks, https://fred.stlouisfed.org/series/UEMPMED unemploynumber of unemployed in thousands, https://fred.stlouisfed.org/series/UNEMPLOY An object of class tbl_df (inherits from tbl, data.frame) with 2870 rows and 4 columns.
element_grob
Generate grid grob from theme element
CRAN · 4.0.3 · ggplot2/man/element_grob.Rd · 2026-05-07

The element_grob() function is vestigial and draw_element() should be used instead.

Aliases
element_grob
Keywords
internal
Usage
element_grob(element, ...)
Arguments
element
Theme element, i.e. element_rect or similar.
...
Other arguments to control specific of rendering. This is usually at least position. See the source code for individual methods.
element_render
Render a specified theme element into a grob
CRAN · 4.0.3 · ggplot2/man/element_render.Rd · 2026-05-07

Given a theme object and element name, returns a grob for the element. Uses [=element_grob]element_grob() to generate the grob.

Aliases
element_render
Keywords
internal
Usage
element_render(theme, element, ..., name = NULL)
Arguments
theme
The theme object
element
The element name given as character vector
...
Other arguments provided to [=element_grob]element_grob()
name
Character vector added to the name of the grob
expand_limits
Expand the plot limits, using data
CRAN · 4.0.3 · ggplot2/man/expand_limits.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#supersededlifecycle-superseded.svgoptions: alt='[Superseded]'[Superseded]: It is recommended to pass a function to the limits argument in scales instead. For example: scale_x_continuous(limits = ~range(.x, 0)) to include zero. Sometimes you may want to ensure limits include a single value, for all panels or all plots. This function is a thin wrapper around [=geom_blank]geom_blank() that makes it easy to add such values.

Aliases
expand_limits
Usage
expand_limits(...)
Arguments
...
named list of aesthetics specifying the value (or values) that should be included in each scale.
Examples
p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p + expand_limits(x = 0) p + expand_limits(y = c(1, 9)) p + expand_limits(x = 0, y = 0) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = cyl)) + expand_limits(colour = seq(2, 10, by = 2)) ggplot(mtcars, aes(mpg, wt)) + geom_point(aes(colour = factor(cyl))) + expand_limits(colour = factor(seq(2, 10, by = 2)))
expansion
Generate expansion vector for scales
CRAN · 4.0.3 · ggplot2/man/expansion.Rd · 2026-05-07

This is a convenience function for generating scale expansion vectors for the expand argument of [=scale_x_continuous]scale_(x|y)_continuous and [=scale_x_discrete]scale_(x|y)_discrete. The expansion vectors are used to add some space between the data and the axes.

Aliases
expansionexpand_scale
Usage
expansion(mult = 0, add = 0) expand_scale(mult = 0, add = 0)
Arguments
mult
vector of multiplicative range expansion factors. If length 1, both the lower and upper limits of the scale are expanded outwards by mult. If length 2, the lower limit is expanded by mult[1] and the upper limit by mult[2].
add
vector of additive range expansion constants. If length 1, both the lower and upper limits of the scale are expanded outwards by add units. If length 2, the lower limit is expanded by add[1] and the upper limit by add[2].
Examples
# No space below the bars but 10% above them ggplot(mtcars) + geom_bar(aes(x = factor(cyl))) + scale_y_continuous(expand = expansion(mult = c(0, .1))) # Add 2 units of space on the left and right of the data ggplot(subset(diamonds, carat > 2), aes(cut, clarity)) + geom_jitter() + scale_x_discrete(expand = expansion(add = 2)) # Reproduce the default range expansion used # when the 'expand' argument is not specified ggplot(subset(diamonds, carat > 2), aes(cut, price)) + geom_jitter() + scale_x_discrete(expand = expansion(add = .6)) + scale_y_continuous(expand = expansion(mult = .05))
facet_grid
Lay out panels in a grid
CRAN · 4.0.3 · ggplot2/man/facet_grid.Rd · 2026-05-07

facet_grid() forms a matrix of panels defined by row and column faceting variables. It is most useful when you have two discrete variables, and all combinations of the variables exist in the data. If you have only one variable with many levels, try [=facet_wrap]facet_wrap().

Aliases
facet_grid
Usage
facet_grid( rows = NULL, cols = NULL, scales = "fixed", space = "fixed", shrink = TRUE, labeller = "label_value", as.table = TRUE, switch = NULL, drop = TRUE, margins = FALSE, axes = "margins", axis.labels = "all", facets = deprecated() )
Arguments
rows, cols
A set of variables or expressions quoted by [=vars]vars() and defining faceting groups on the rows or columns dimension. The variables can be named (the names are passed to labeller). For compatibility with the classic interface, rows can also be a formula with the rows (of the tabular display) on the LHS and the columns (of the tabular display) on the RHS; the dot in the formula is used to indicate there should be no faceting on this dimension (either row or column).
scales
Are scales shared across all facets (the default, "fixed"), or do they vary across rows ("free_x"), columns ("free_y"), or both rows and columns ("free")?
space
If "fixed", the default, all panels have the same size. If "free_y" their height will be proportional to the length of the y scale; if "free_x" their width will be proportional to the length of the x scale; or if "free" both height and width will vary. This setting has no effect unless the appropriate scales also vary.
shrink
If TRUE, will shrink scales to fit output of statistics, not raw data. If FALSE, will be range of raw data before statistical summary.
labeller
A function that takes one data frame of labels and returns a list or data frame of character vectors. Each input column corresponds to one factor. Thus there will be more than one with vars(cyl, am). Each output column gets displayed as one separate line in the strip label. This function should inherit from the "labeller" S3 class for compatibility with [=labeller]labeller(). You can use different labeling functions for different kind of labels, for example use [=label_parsed]label_parsed() for formatting facet labels. [=label_value]label_value() is used by default, check it for more details and pointers to other options.
as.table
If TRUE, the default, the facets are laid out like a table with highest values at the bottom-right. If FALSE, the facets are laid out like a plot with the highest value at the top-right.
switch
By default, the labels are displayed on the top and right of the plot. If "x", the top labels will be displayed to the bottom. If "y", the right-hand side labels will be displayed to the left. Can also be set to "both".
drop
If TRUE, the default, all factor levels not used in the data will automatically be dropped. If FALSE, all factor levels will be shown, regardless of whether or not they appear in the data.
margins
Either a logical value or a character vector. Margins are additional facets which contain all the data for each of the possible values of the faceting variables. If FALSE, no additional facets are included (the default). If TRUE, margins are included for all faceting variables. If specified as a character vector, it is the names of variables for which margins are to be created.
axes
Determines which axes will be drawn. When "margins" (default), axes will be drawn at the exterior margins. "all_x" and "all_y" will draw the respective axes at the interior panels too, whereas "all" will draw all axes at all panels.
axis.labels
Determines whether to draw labels for interior axes when the axes argument is not "margins". When "all" (default), all interior axes get labels. When "margins", only the exterior axes get labels and the interior axes get none. When "all_x" or "all_y", only draws the labels at the interior axes in the x- or y-direction respectively.
facets
htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] Please use rows and cols instead.
Examples
p <- ggplot(mpg, aes(displ, cty)) + geom_point() # Use vars() to supply variables from the dataset: p + facet_grid(rows = vars(drv)) p + facet_grid(cols = vars(cyl)) p + facet_grid(vars(drv), vars(cyl)) # To change plot order of facet grid, # change the order of variable levels with factor() # If you combine a facetted dataset with a dataset that lacks those # faceting variables, the data will be repeated across the missing # combinations: df <- data.frame(displ = mean(mpg$displ), cty = mean(mpg$cty)) p + facet_grid(cols = vars(cyl)) + geom_point(data = df, colour = "red", size = 2) # When scales are constant, duplicated axes can be shown with # or without labels ggplot(mpg, aes(cty, hwy)) + geom_point() + facet_grid(year ~ drv, axes = "all", axis.labels = "all_x") # Free scales ------------------------------------------------------- # You can also choose whether the scales should be constant # across all panels (the default), or whether they should be allowed # to vary mt <- ggplot(mtcars, aes(mpg, wt, colour = factor(cyl))) + geom_point() mt + facet_grid(vars(cyl), scales = "free") # If scales and space are free, then the mapping between position # and values in the data will be the same across all panels. This # is particularly useful for categorical axes ggplot(mpg, aes(drv, model)) + geom_point() + facet_grid(manufacturer ~ ., scales = "free", space = "free") + theme(strip.text.y = element_text(angle = 0)) # Margins ---------------------------------------------------------- # Margins can be specified logically (all yes or all no) or for specific # variables as (character) variable names mg <- ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point() mg + facet_grid(vs + am ~ gear, margins = TRUE) mg + facet_grid(vs + am ~ gear, margins = "am") # when margins are made over "vs", since the facets for "am" vary # within the values of "vs", the marginal facet for "vs" is also # a margin over "am". mg + facet_grid(vs + am ~ gear, margins = "vs")
See also
The https://ggplot2-book.org/facet#facet-gridfacet grid section of the online ggplot2 book.
Custom sections
Layer layout
The [=layer]layer(layout) argument in context of facet_grid() can take the following values: NULL (default) to use the faceting variables to assign panels. An integer vector to include selected panels. Panel numbers not included in the integer vector are excluded. "fixed" to repeat data across every panel. "fixed_rows" to repeat data across rows. "fixed_cols" to repeat data across columns.
facet_null
Facet specification: a single panel.
CRAN · 4.0.3 · ggplot2/man/facet_null.Rd · 2026-05-07

Facet specification: a single panel.

Aliases
facet_null
Keywords
internal
Usage
facet_null(shrink = TRUE)
Arguments
shrink
If TRUE, will shrink scales to fit output of statistics, not raw data. If FALSE, will be range of raw data before statistical summary.
Examples
# facet_null is the default faceting specification if you # don't override it with facet_grid or facet_wrap ggplot(mtcars, aes(mpg, wt)) + geom_point()
Custom sections
Layer layout
The [=layer]layer(layout) argument in context of facet_null() is completely ignored.
facet_wrap
Wrap a 1d ribbon of panels into 2d
CRAN · 4.0.3 · ggplot2/man/facet_wrap.Rd · 2026-05-07

facet_wrap() wraps a 1d sequence of panels into 2d. This is generally a better use of screen space than [=facet_grid]facet_grid() because most displays are roughly rectangular.

Aliases
facet_wrap
Usage
facet_wrap( facets, nrow = NULL, ncol = NULL, scales = "fixed", space = "fixed", shrink = TRUE, labeller = "label_value", as.table = TRUE, switch = deprecated(), drop = TRUE, dir = "h", strip.position = "top", axes = "margins", axis.labels = "all" )
Arguments
facets
A set of variables or expressions quoted by [=vars]vars() and defining faceting groups on the rows or columns dimension. The variables can be named (the names are passed to labeller). For compatibility with the classic interface, can also be a formula or character vector. Use either a one sided formula, ~a + b, or a character vector, c("a", "b").
nrow, ncol
Number of rows and columns.
scales
Should scales be fixed ("fixed", the default), free ("free"), or free in one dimension ("free_x", "free_y")?
space
If "fixed" (default), all panels have the same size and the number of rows and columns in the layout can be arbitrary. If "free_x", panels have widths proportional to the length of the x-scale, but the layout is constrained to one row. If "free_y", panels have heights proportional to the length of the y-scale, but the layout is constrained to one column.
shrink
If TRUE, will shrink scales to fit output of statistics, not raw data. If FALSE, will be range of raw data before statistical summary.
labeller
A function that takes one data frame of labels and returns a list or data frame of character vectors. Each input column corresponds to one factor. Thus there will be more than one with vars(cyl, am). Each output column gets displayed as one separate line in the strip label. This function should inherit from the "labeller" S3 class for compatibility with [=labeller]labeller(). You can use different labeling functions for different kind of labels, for example use [=label_parsed]label_parsed() for formatting facet labels. [=label_value]label_value() is used by default, check it for more details and pointers to other options.
as.table
htmlhttps://lifecycle.r-lib.org/articles/stages.html#supersededlifecycle-superseded.svgoptions: alt='[Superseded]'[Superseded] The as.table argument is now absorbed into the dir argument via the two letter options. If TRUE, the facets are laid out like a table with highest values at the bottom-right. If FALSE, the facets are laid out like a plot with the highest value at the top-right.
switch
By default, the labels are displayed on the top and right of the plot. If "x", the top labels will be displayed to the bottom. If "y", the right-hand side labels will be displayed to the left. Can also be set to "both".
drop
If TRUE, the default, all factor levels not used in the data will automatically be dropped. If FALSE, all factor levels will be shown, regardless of whether or not they appear in the data.
dir
Direction: either "h" for horizontal, the default, or "v", for vertical. When "h" or "v" will be combined with as.table to set final layout. Alternatively, a combination of "t" (top) or "b" (bottom) with "l" (left) or "r" (right) to set a layout directly. These two letters give the starting position and the first letter gives the growing direction. For example "rt" will place the first panel in the top-right and starts filling in panels right-to-left.
strip.position
By default, the labels are displayed on the top of the plot. Using strip.position it is possible to place the labels on either of the four sides by setting strip.position = c("top", "bottom", "left", "right")
axes
Determines which axes will be drawn in case of fixed scales. When "margins" (default), axes will be drawn at the exterior margins. "all_x" and "all_y" will draw the respective axes at the interior panels too, whereas "all" will draw all axes at all panels.
axis.labels
Determines whether to draw labels for interior axes when the scale is fixed and the axis argument is not "margins". When "all" (default), all interior axes get labels. When "margins", only the exterior axes get labels, and the interior axes get none. When "all_x" or "all_y", only draws the labels at the interior axes in the x- or y-direction respectively.
Examples
p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Use vars() to supply faceting variables: p + facet_wrap(vars(class)) # Control the number of rows and columns with nrow and ncol p + facet_wrap(vars(class), nrow = 4) # You can facet by multiple variables ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(vars(cyl, drv)) # Use the `labeller` option to control how labels are printed: ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(vars(cyl, drv), labeller = "label_both") # To change the order in which the panels appear, change the levels # of the underlying factor. mpg$class2 <- reorder(mpg$class, mpg$displ) ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(vars(class2)) # By default, the same scales are used for all panels. You can allow # scales to vary across the panels with the `scales` argument. # Free scales make it easier to see patterns within each panel, but # harder to compare across panels. ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(vars(class), scales = "free") # When scales are constant, duplicated axes can be shown with # or without labels ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(vars(class), axes = "all", axis.labels = "all_y") # To repeat the same data in every panel, simply construct a data frame # that does not contain the faceting variable. ggplot(mpg, aes(displ, hwy)) + geom_point(data = transform(mpg, class = NULL), colour = "grey85") + geom_point() + facet_wrap(vars(class)) # Use `strip.position` to display the facet labels at the side of your # choice. Setting it to `bottom` makes it act as a subtitle for the axis. # This is typically used with free scales and a theme without boxes around # strip labels. ggplot(economics_long, aes(date, value)) + geom_line() + facet_wrap(vars(variable), scales = "free_y", nrow = 2, strip.position = "top") + theme(strip.background = element_blank(), strip.placement = "outside") # The two letters determine the starting position, so 'tr' starts # in the top-right. # The first letter determines direction, so 'tr' fills top-to-bottom. # `dir = "tr"` is equivalent to `dir = "v", as.table = FALSE` ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(vars(class), dir = "tr")
See also
The https://ggplot2-book.org/facet#sec-facet-wrapfacet wrap section of the online ggplot2 book.
Custom sections
Layer layout
The [=layer]layer(layout) argument in context of facet_wrap() can take the following values: NULL (default) to use the faceting variables to assign panels. An integer vector to include selected panels. Panel numbers not included in the integer vector are excluded. "fixed" to repeat data across every panel.
faithfuld
2d density estimate of Old Faithful data
CRAN · 4.0.3 · data · ggplot2/man/faithfuld.Rd · 2026-05-07

A 2d density estimate of the waiting and eruptions variables data faithful.

Aliases
faithfuld
Keywords
datasets
Usage
faithfuld
Format
A data frame with 5,625 observations and 3 variables: eruptionsEruption time in mins waitingWaiting time to next eruption in mins density2d density estimate
fill_alpha
Modify fill transparency
CRAN · 4.0.3 · ggplot2/man/fill_alpha.Rd · 2026-05-07

This works much like [scales:alpha]alpha() in that it modifies the transparency of fill colours. It differs in that fill_alpha() also attempts to set the transparency of <GridPattern> objects.

Aliases
fill_alpha
Keywords
internal
Usage
fill_alpha(fill, alpha)
Arguments
fill
A fill colour given as a character or integer vector, or as a (list of) <GridPattern> object(s).
alpha
A transparency value between 0 (transparent) and 1 (opaque), parallel to fill.
Value
A character vector of colours, or list of <GridPattern> objects.
Examples
# Typical colour input fill_alpha("red", 0.5) if (utils::packageVersion("grid") > "4.2") # Pattern input fill_alpha(list(grid::linearGradient()), 0.5)
find_panel
Find panels in a gtable
CRAN · 4.0.3 · ggplot2/man/find_panel.Rd · 2026-05-07

These functions help detect the placement of panels in a gtable, if they are named with "panel" in the beginning. find_panel() returns the extend of the panel area, while panel_cols() and panel_rows() returns the columns and rows that contains panels respectively.

Aliases
find_panelpanel_colspanel_rows
Keywords
internal
Usage
find_panel(table) panel_cols(table) panel_rows(table)
Arguments
table
A gtable
Value
A data.frame with some or all of the columns t(op), r(ight), b(ottom), and l(eft)
fortify
Fortify a model with data.
CRAN · 4.0.3 · ggplot2/man/fortify.Rd · 2026-05-07

Rather than using this function, I now recommend using the broom package, which implements a much wider range of methods. fortify() may be deprecated in the future.

Aliases
fortify
Concepts
plotting automation topics
Usage
fortify(model, data, ...)
Arguments
model
model or other R object to convert to data frame
data
original dataset, if needed
...
Arguments passed to methods.
See also
[=fortify.lm]fortify.lm() Other plotting automation topics: autolayer(), automatic_plotting, autoplot()
fortify-multcomp
Fortify methods for objects produced by multcomp
CRAN · 4.0.3 · ggplot2/man/fortify-multcomp.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] This function is deprecated because using broom::tidy() is a better solution to convert model objects.

Aliases
fortify-multcompfortify.glhtfortify.confint.glhtfortify.summary.glhtfortify.cld
Keywords
internal
Usage
fortifyglht(model, data, ...) fortifyconfint.glht(model, data, ...) fortifysummary.glht(model, data, ...) fortifycld(model, data, ...)
Arguments
model
an object of class glht, confint.glht, summary.glht or [multcomp:cld]multcomp::cld()
data, ...
other arguments to the generic ignored in this method.
Examples
if (require("multcomp") && require("broom")) withAutoprint(\ # examplesIf amod <- aov(breaks ~ wool + tension, data = warpbreaks) wht <- multcomp::glht(amod, linfct = multcomp::mcp(tension = "Tukey")) tidy(wht) # recommended fortify(wht) ggplot(tidy(wht), aes(contrast, estimate)) + geom_point() ci <- confint(wht) tidy(ci) # recommended fortify(ci) ggplot(tidy(confint(wht)), aes(contrast, estimate, ymin = conf.low, ymax = conf.high)) + geom_pointrange() smry <- summary(wht) tidy(smry) # recommended fortify(smry) ggplot(mapping = aes(contrast, estimate)) + geom_linerange(aes(ymin = conf.low, ymax = conf.high), data = tidy(ci)) + geom_point(aes(size = adj.p.value), data = tidy(smry)) + scale_size(transform = "reverse") cld <- multcomp::cld(wht) tidy(cld) # recommended fortify(cld) \) # examplesIf
fortify.lm
Supplement the data fitted to a linear model with model fit statistics.
CRAN · 4.0.3 · ggplot2/man/fortify.lm.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] This method is deprecated because using broom::augment() is a better solution to supplement data from a linear model. If you have missing values in your model data, you may need to refit the model with na.action = na.exclude.

Aliases
fortify.lm
Keywords
internal
Usage
fortifylm(model, data = model$model, ...)
Arguments
model
linear model
data
data set, defaults to data used to fit model
...
not used by this method
Value
The original data with extra columns: .hatDiagonal of the hat matrix .sigmaEstimate of residual standard deviation when corresponding observation is dropped from model .cooksdCooks distance, [=cooks.distance]cooks.distance() .fittedFitted values of model .residResiduals .stdresidStandardised residuals
Examples
if (require("broom")) withAutoprint(\ # examplesIf mod <- lm(mpg ~ wt, data = mtcars) # Show augmented model head(augment(mod)) head(fortify(mod)) # Using augment to convert model to ready-to-plot data ggplot(augment(mod), aes(.fitted, .resid)) + geom_point() + geom_hline(yintercept = 0) + geom_smooth(se = FALSE) # Colouring by original data not included in the model ggplot(augment(mod, mtcars), aes(.fitted, .std.resid, colour = factor(cyl))) + geom_point() \) # examplesIf
fortify.map
Fortify method for map objects
CRAN · 4.0.3 · ggplot2/man/fortify.map.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] This function turns a map into a data frame that can more easily be plotted with ggplot2.

Aliases
fortify.map
Keywords
internal
Usage
fortifymap(model, data, ...)
Arguments
model
map object
data
not used by this method
...
not used by this method
Examples
if (require("maps")) ca <- map("county", "ca", plot = FALSE, fill = TRUE) head(fortify(ca)) ggplot(ca, aes(long, lat)) + geom_polygon(aes(group = group)) if (require("maps")) tx <- map("county", "texas", plot = FALSE, fill = TRUE) head(fortify(tx)) ggplot(tx, aes(long, lat)) + geom_polygon(aes(group = group), colour = "white")
See also
[=map_data]map_data() and [=annotation_borders]annotation_borders()
fortify.sp
Fortify method for classes from the sp package.
CRAN · 4.0.3 · ggplot2/man/fortify.sp.Rd · 2026-05-07

htmlhttps://lifecycle.r-lib.org/articles/stages.html#deprecatedlifecycle-deprecated.svgoptions: alt='[Deprecated]'[Deprecated] To figure out the correct variable name for region, inspect as.data.frame(model).

Aliases
fortify.spfortify.SpatialPolygonsDataFramefortify.SpatialPolygonsfortify.Polygonsfortify.Polygonfortify.SpatialLinesDataFramefortify.Linesfortify.Line
Keywords
internal
Usage
fortifySpatialPolygonsDataFrame(model, data, region = NULL, ...) fortifySpatialPolygons(model, data, ...) fortifyPolygons(model, data, ...) fortifyPolygon(model, data, ...) fortifySpatialLinesDataFrame(model, data, ...) fortifyLines(model, data, ...) fortifyLine(model, data, ...)
Arguments
model
SpatialPolygonsDataFrame to convert into a dataframe.
data
not used by this method
region
name of variable used to split up regions
...
not used by this method
geom_abline
Reference lines: horizontal, vertical, and diagonal
CRAN · 4.0.3 · ggplot2/man/geom_abline.Rd · 2026-05-07

These geoms add reference lines (sometimes called rules) to a plot, either horizontal, vertical, or diagonal (specified by slope and intercept). These are useful for annotating plots.

Aliases
geom_ablinegeom_hlinegeom_vline
Usage
geom_abline( mapping = NULL, data = NULL, stat = "identity", ..., slope, intercept, na.rm = FALSE, show.legend = NA, inherit.aes = FALSE ) geom_hline( mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., yintercept, na.rm = FALSE, show.legend = NA, inherit.aes = FALSE ) geom_vline( mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., xintercept, na.rm = FALSE, show.legend = NA, inherit.aes = FALSE )
Arguments
mapping
Set of aesthetic mappings created by [=aes]aes().
data
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to [=ggplot]ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See [=fortify]fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).
stat
The statistical transformation to use on the data for this layer. When using a geom_*() function to construct a layer, the stat argument can be used to override the default coupling between geoms and stats. The stat argument accepts the following: A Stat ggproto subclass, for example StatCount. A string naming the stat. To give the stat as a string, strip the function name of the stat_ prefix. For example, to use stat_count(), give the stat as "count". For more information and other ways to specify the stat, see the [=layer_stats]layer stat documentation.
...
Other arguments passed on to [=layer]layer()'s params argument. These arguments broadly fall into one of 4 categories below. Notably, further arguments to the position argument, or aesthetics that are required can not be passed through .... Unknown arguments that are not part of the 4 categories below are ignored. Static aesthetics that are not mapped to a scale, but are at a fixed value and apply to the layer as a whole. For example, colour = "red" or linewidth = 3. The geom's documentation has an Aesthetics section that lists the available options. The 'required' aesthetics cannot be passed on to the params. Please note that while passing unmapped aesthetics as vectors is technically possible, the order and required length is not guaranteed to be parallel to the input data. When constructing a layer using a stat_*() function, the ... argument can be used to pass on parameters to the geom part of the layer. An example of this is stat_density(geom = "area", outline.type = "both"). The geom's documentation lists which parameters it can accept. Inversely, when constructing a layer using a geom_*() function, the ... argument can be used to pass on parameters to the stat part of the layer. An example of this is geom_area(stat = "density", adjust = 0.5). The stat's documentation lists which parameters it can accept. The key_glyph argument of [=layer]layer() may also be passed on through .... This can be one of the functions described as [=draw_key]key glyphs, to change the display of the layer in the legend.
na.rm
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, use TRUE. If NA, all levels are shown in legend, but unobserved levels are omitted.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. [=annotation_borders]annotation_borders().
position
A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following: The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position. A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter". For more information and other ways to specify the position, see the [=layer_positions]layer position documentation.
xintercept, yintercept, slope, intercept
Parameters that control the position of the line. If these are set, data, mapping and show.legend are overridden.
Details
These geoms act slightly differently from other geoms. You can supply the parameters in two ways: either as arguments to the layer function, or via aesthetics. If you use arguments, e.g. geom_abline(intercept = 0, slope = 1), then behind the scenes the geom makes a new data frame containing just the data you've supplied. That means that the lines will be the same in all facets; if you want them to vary across facets, construct the data frame yourself and use aesthetics. Unlike most other geoms, these geoms do not inherit aesthetics from the plot default, because they do not understand x and y aesthetics which are commonly set in the plot. They also do not affect the x and y scales.
Examples
p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() # Fixed values p + geom_vline(xintercept = 5) p + geom_vline(xintercept = 1:5) p + geom_hline(yintercept = 20) p + geom_abline() # Can't see it - outside the range of the data p + geom_abline(intercept = 20) # Calculate slope and intercept of line of best fit coef(lm(mpg ~ wt, data = mtcars)) p + geom_abline(intercept = 37, slope = -5) # But this is easier to do with geom_smooth: p + geom_smooth(method = "lm", se = FALSE) # To show different lines in different facets, use aesthetics p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_wrap(~ cyl) mean_wt <- data.frame(cyl = c(4, 6, 8), wt = c(2.28, 3.11, 4.00)) p + geom_hline(aes(yintercept = wt), mean_wt) # You can also control other aesthetics ggplot(mtcars, aes(mpg, wt, colour = wt)) + geom_point() + geom_hline(aes(yintercept = wt, colour = wt), mean_wt) + facet_wrap(~ cyl)
See also
See [=geom_segment]geom_segment() for a more general approach to adding straight line segments to a plot.
Custom sections
Aesthetics
These geoms are drawn using [=geom_line]geom_line() so they support the same aesthetics: alpha, colour, linetype and linewidth. They also each have aesthetics that control the position of the line: geom_vline(): xintercept geom_hline(): yintercept geom_abline(): slope and intercept
geom_bar
Bar charts
CRAN · 4.0.3 · ggplot2/man/geom_bar.Rd · 2026-05-07

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 the weights). If you want the heights of the bars to represent values in the data, use geom_col() instead. geom_bar() uses stat_count() by default: it counts the number of cases at each x position. geom_col() uses stat_identity(): it leaves the data as is.

Aliases
geom_bargeom_colstat_count
Usage
geom_bar( mapping = NULL, data = NULL, stat = "count", position = "stack", ..., just = 0.5, lineend = "butt", linejoin = "mitre", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) geom_col( mapping = NULL, data = NULL, stat = "identity", position = "stack", ..., just = 0.5, lineend = "butt", linejoin = "mitre", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_count( mapping = NULL, data = NULL, geom = "bar", position = "stack", ..., orientation = NA, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
Arguments
mapping
Set of aesthetic mappings created by [=aes]aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.
data
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to [=ggplot]ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See [=fortify]fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).
position
A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following: The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position. A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter". For more information and other ways to specify the position, see the [=layer_positions]layer position documentation.
...
Other arguments passed on to [=layer]layer()'s params argument. These arguments broadly fall into one of 4 categories below. Notably, further arguments to the position argument, or aesthetics that are required can not be passed through .... Unknown arguments that are not part of the 4 categories below are ignored. Static aesthetics that are not mapped to a scale, but are at a fixed value and apply to the layer as a whole. For example, colour = "red" or linewidth = 3. The geom's documentation has an Aesthetics section that lists the available options. The 'required' aesthetics cannot be passed on to the params. Please note that while passing unmapped aesthetics as vectors is technically possible, the order and required length is not guaranteed to be parallel to the input data. When constructing a layer using a stat_*() function, the ... argument can be used to pass on parameters to the geom part of the layer. An example of this is stat_density(geom = "area", outline.type = "both"). The geom's documentation lists which parameters it can accept. Inversely, when constructing a layer using a geom_*() function, the ... argument can be used to pass on parameters to the stat part of the layer. An example of this is geom_area(stat = "density", adjust = 0.5). The stat's documentation lists which parameters it can accept. The key_glyph argument of [=layer]layer() may also be passed on through .... This can be one of the functions described as [=draw_key]key glyphs, to change the display of the layer in the legend.
just
Adjustment for column placement. Set to 0.5 by default, meaning that columns will be centered about axis breaks. Set to 0 or 1 to place columns to the left/right of axis breaks. Note that this argument may have unintended behaviour when used with alternative positions, e.g. position_dodge().
lineend
Line end style (round, butt, square).
linejoin
Line join style (round, mitre, bevel).
na.rm
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, use TRUE. If NA, all levels are shown in legend, but unobserved levels are omitted.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. [=annotation_borders]annotation_borders().
geom, stat
Override the default connection between geom_bar() and stat_count(). For more information about overriding these connections, see how the [=layer_stats]stat and [=layer_geoms]geom arguments work.
orientation
The orientation of the layer. The default (NA) automatically determines the orientation from the aesthetic mapping. In the rare event that this fails it can be given explicitly by setting orientation to either "x" or "y". See the Orientation section for more detail.
Details
A bar chart uses height to represent a value, and so the base of the bar must always be shown to produce a valid visual comparison. Proceed with caution when using transformed scales with a bar chart. It's important to always use a meaningful reference point for the base of the bar. For example, for log transformations the reference point is 1. In fact, when using a log scale, geom_bar() automatically places the base of the bar at 1. Furthermore, never use stacked bars with a transformed scale, because scaling happens before stacking. As a consequence, the height of bars will be wrong when stacking occurs with a transformed scale. By default, multiple bars occupying the same x position will be stacked atop one another by [=position_stack]position_stack(). If you want them to be dodged side-to-side, use [=position_dodge]position_dodge() or [=position_dodge2]position_dodge2(). Finally, [=position_fill]position_fill() shows relative proportions at each x by stacking the bars and then standardising each bar to have the same height.
Examples
# geom_bar is designed to make it easy to create bar charts that show # counts (or sums of weights) g <- ggplot(mpg, aes(class)) # Number of cars in each class: g + geom_bar() # Total engine displacement of each class g + geom_bar(aes(weight = displ)) # Map class to y instead to flip the orientation ggplot(mpg) + geom_bar(aes(y = class)) # Bar charts are automatically stacked when multiple bars are placed # at the same location. The order of the fill is designed to match # the legend g + geom_bar(aes(fill = drv)) # If you need to flip the order (because you've flipped the orientation) # call position_stack() explicitly: ggplot(mpg, aes(y = class)) + geom_bar(aes(fill = drv), position = position_stack(reverse = TRUE)) + theme(legend.position = "top") # To show (e.g.) means, you need geom_col() df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2)) ggplot(df, aes(trt, outcome)) + geom_col() # But geom_point() displays exactly the same information and doesn't # require the y-axis to touch zero. ggplot(df, aes(trt, outcome)) + geom_point() # You can also use geom_bar() with continuous data, in which case # it will show counts at unique locations df <- data.frame(x = rep(c(2.9, 3.1, 4.5), c(5, 10, 4))) ggplot(df, aes(x)) + geom_bar() # cf. a histogram of the same data ggplot(df, aes(x)) + geom_histogram(binwidth = 0.5) # Use `just` to control how columns are aligned with axis breaks: df <- data.frame(x = as.Date(c("2020-01-01", "2020-02-01")), y = 1:2) # Columns centered on the first day of the month ggplot(df, aes(x, y)) + geom_col(just = 0.5) # Columns begin on the first day of the month ggplot(df, aes(x, y)) + geom_col(just = 1)
See also
[=geom_histogram]geom_histogram() for continuous data, [=position_dodge]position_dodge() and [=position_dodge2]position_dodge2() for creating side-by-side bar charts. [=stat_bin]stat_bin(), which bins data in ranges and counts the cases in each range. It differs from stat_count(), which counts the number of cases at each x position (without binning into ranges). [=stat_bin]stat_bin() requires continuous x data, whereas stat_count() can be used for both discrete and continuous x data.
Custom sections
Orientation
This geom treats each axis differently and, thus, can thus have two orientations. Often the orientation is easy to deduce from a combination of the given mappings and the types of positional scales in use. Thus, ggplot2 will by default try to guess which orientation the layer should have. Under rare circumstances, the orientation is ambiguous and guessing may fail. In that case the orientation can be specified directly using the orientation parameter, which can be either "x" or "y". The value gives the axis that the geom should run along, "x" being the default orientation you would expect for the geom.
Computed variables
These are calculated by the 'stat' part of layers and can be accessed with [=aes_eval]delayed evaluation. after_stat(count) number of points in bin. after_stat(prop) groupwise proportion
Aesthetics
geom_bar() understands the following aesthetics. Required aesthetics are displayed in bold and defaults are displayed for optional aesthetics: rll • [=aes_position]x • [=aes_position]y • [=aes_colour_fill_alpha]alpha → NA • [=aes_colour_fill_alpha]colour → via theme() • [=aes_colour_fill_alpha]fill → via theme() • [=aes_group_order]group → inferred • [=aes_linetype_size_shape]linetype → via theme() • [=aes_linetype_size_shape]linewidth → via theme() • width → 0.9 geom_col() understands the following aesthetics. Required aesthetics are displayed in bold and defaults are displayed for optional aesthetics: rll • [=aes_position]x • [=aes_position]y • [=aes_colour_fill_alpha]alpha → NA • [=aes_colour_fill_alpha]colour → via theme() • [=aes_colour_fill_alpha]fill → via theme() • [=aes_group_order]group → inferred • [=aes_linetype_size_shape]linetype → via theme() • [=aes_linetype_size_shape]linewidth → via theme() • width → 0.9 stat_count() understands the following aesthetics. Required aesthetics are displayed in bold and defaults are displayed for optional aesthetics: rll • [=aes_position]x or [=aes_position]y • [=aes_group_order]group → inferred • weight → 1 Learn more about setting these aesthetics in vignette("ggplot2-specs").
geom_bin_2d
Heatmap of 2d bin counts
CRAN · 4.0.3 · ggplot2/man/geom_bin_2d.Rd · 2026-05-07

Divides the plane into rectangles, counts the number of cases in each rectangle, and then (by default) maps the number of cases to the rectangle's fill. This is a useful alternative to [=geom_point]geom_point() in the presence of overplotting.

Aliases
geom_bin_2dgeom_bin2dstat_bin_2dstat_bin2d
Usage
geom_bin_2d( mapping = NULL, data = NULL, stat = "bin2d", position = "identity", ..., lineend = "butt", linejoin = "mitre", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) stat_bin_2d( mapping = NULL, data = NULL, geom = "tile", position = "identity", ..., binwidth = NULL, bins = 30, breaks = NULL, drop = TRUE, boundary = NULL, closed = NULL, center = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
Arguments
mapping
Set of aesthetic mappings created by [=aes]aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.
data
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to [=ggplot]ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See [=fortify]fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).
position
A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following: The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position. A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter". For more information and other ways to specify the position, see the [=layer_positions]layer position documentation.
...
Other arguments passed on to [=layer]layer()'s params argument. These arguments broadly fall into one of 4 categories below. Notably, further arguments to the position argument, or aesthetics that are required can not be passed through .... Unknown arguments that are not part of the 4 categories below are ignored. Static aesthetics that are not mapped to a scale, but are at a fixed value and apply to the layer as a whole. For example, colour = "red" or linewidth = 3. The geom's documentation has an Aesthetics section that lists the available options. The 'required' aesthetics cannot be passed on to the params. Please note that while passing unmapped aesthetics as vectors is technically possible, the order and required length is not guaranteed to be parallel to the input data. When constructing a layer using a stat_*() function, the ... argument can be used to pass on parameters to the geom part of the layer. An example of this is stat_density(geom = "area", outline.type = "both"). The geom's documentation lists which parameters it can accept. Inversely, when constructing a layer using a geom_*() function, the ... argument can be used to pass on parameters to the stat part of the layer. An example of this is geom_area(stat = "density", adjust = 0.5). The stat's documentation lists which parameters it can accept. The key_glyph argument of [=layer]layer() may also be passed on through .... This can be one of the functions described as [=draw_key]key glyphs, to change the display of the layer in the legend.
lineend
Line end style (round, butt, square).
linejoin
Line join style (round, mitre, bevel).
na.rm
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, use TRUE. If NA, all levels are shown in legend, but unobserved levels are omitted.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. [=annotation_borders]annotation_borders().
geom, stat
Use to override the default connection between geom_bin_2d() and stat_bin_2d(). For more information about overriding these connections, see how the [=layer_stats]stat and [=layer_geoms]geom arguments work.
binwidth
The width of the bins. Can be specified as a numeric value or as a function that takes x after scale transformation as input and returns a single numeric value. When specifying a function along with a grouping structure, the function will be called once per group. The default is to use the number of bins in bins, covering the range of the data. You should always override this value, exploring multiple widths to find the best to illustrate the stories in your data. The bin width of a date variable is the number of days in each time; the bin width of a time variable is the number of seconds.
bins
Number of bins. Overridden by binwidth. Defaults to 30.
breaks
Alternatively, you can supply a numeric vector giving the bin boundaries. Overrides binwidth, bins, center, and boundary. Can also be a function that takes group-wise values as input and returns bin boundaries.
drop
if TRUE removes all cells with 0 counts.
closed
One of "right" or "left" indicating whether right or left edges of bins are included in the bin.
center, boundary
bin position specifiers. Only one, center or boundary, may be specified for a single plot. center specifies the center of one of the bins. boundary specifies the boundary between two bins. Note that if either is above or below the range of the data, things will be shifted by the appropriate integer multiple of binwidth. For example, to center on integers use binwidth = 1 and center = 0, even if 0 is outside the range of the data. Alternatively, this same alignment can be specified with binwidth = 1 and boundary = 0.5, even if 0.5 is outside the range of the data.
Examples
d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10) d + geom_bin_2d() # You can control the size of the bins by specifying the number of # bins in each direction: d + geom_bin_2d(bins = 10) d + geom_bin_2d(bins = list(x = 30, y = 10)) # Or by specifying the width of the bins d + geom_bin_2d(binwidth = c(0.1, 0.1))
See also
[=stat_bin_hex]stat_bin_hex() for hexagonal binning
Custom sections
Computed variables
These are calculated by the 'stat' part of layers and can be accessed with [=aes_eval]delayed evaluation. after_stat(count) number of points in bin. after_stat(density) density of points in bin, scaled to integrate to 1. after_stat(ncount) count, scaled to maximum of 1. after_stat(ndensity) density, scaled to a maximum of 1.
Controlling binning parameters for the x and y directions
The arguments bins, binwidth, breaks, center, and boundary can be set separately for the x and y directions. When given as a scalar, one value applies to both directions. When given as a vector of length two, the first is applied to the x direction and the second to the y direction. Alternatively, these can be a named list containing x and y elements, for example list(x = 10, y = 20).
Aesthetics
geom_bin2d() understands the following aesthetics. Required aesthetics are displayed in bold and defaults are displayed for optional aesthetics: rll • [=aes_position]x • [=aes_position]y • [=aes_colour_fill_alpha]alpha → NA • [=aes_colour_fill_alpha]colour → via theme() • [=aes_colour_fill_alpha]fill → via theme() • [=aes_group_order]group → inferred • height → 1 • [=aes_linetype_size_shape]linetype → via theme() • [=aes_linetype_size_shape]linewidth → via theme() • width → 1 Learn more about setting these aesthetics in vignette("ggplot2-specs").
geom_blank
Draw nothing
CRAN · 4.0.3 · ggplot2/man/geom_blank.Rd · 2026-05-07

The blank geom draws nothing, but can be a useful way of ensuring common scales between different plots. See [=expand_limits]expand_limits() for more details.

Aliases
geom_blank
Usage
geom_blank( mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., show.legend = NA, inherit.aes = TRUE )
Arguments
mapping
Set of aesthetic mappings created by [=aes]aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.
data
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to [=ggplot]ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See [=fortify]fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).
stat
The statistical transformation to use on the data for this layer. When using a geom_*() function to construct a layer, the stat argument can be used to override the default coupling between geoms and stats. The stat argument accepts the following: A Stat ggproto subclass, for example StatCount. A string naming the stat. To give the stat as a string, strip the function name of the stat_ prefix. For example, to use stat_count(), give the stat as "count". For more information and other ways to specify the stat, see the [=layer_stats]layer stat documentation.
position
A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following: The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position. A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter". For more information and other ways to specify the position, see the [=layer_positions]layer position documentation.
...
Other arguments passed on to [=layer]layer()'s params argument. These arguments broadly fall into one of 4 categories below. Notably, further arguments to the position argument, or aesthetics that are required can not be passed through .... Unknown arguments that are not part of the 4 categories below are ignored. Static aesthetics that are not mapped to a scale, but are at a fixed value and apply to the layer as a whole. For example, colour = "red" or linewidth = 3. The geom's documentation has an Aesthetics section that lists the available options. The 'required' aesthetics cannot be passed on to the params. Please note that while passing unmapped aesthetics as vectors is technically possible, the order and required length is not guaranteed to be parallel to the input data. When constructing a layer using a stat_*() function, the ... argument can be used to pass on parameters to the geom part of the layer. An example of this is stat_density(geom = "area", outline.type = "both"). The geom's documentation lists which parameters it can accept. Inversely, when constructing a layer using a geom_*() function, the ... argument can be used to pass on parameters to the stat part of the layer. An example of this is geom_area(stat = "density", adjust = 0.5). The stat's documentation lists which parameters it can accept. The key_glyph argument of [=layer]layer() may also be passed on through .... This can be one of the functions described as [=draw_key]key glyphs, to change the display of the layer in the legend.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, use TRUE. If NA, all levels are shown in legend, but unobserved levels are omitted.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. [=annotation_borders]annotation_borders().
Examples
ggplot(mtcars, aes(wt, mpg)) # Nothing to see here!
geom_boxplot
A box and whiskers plot (in the style of Tukey)
CRAN · 4.0.3 · ggplot2/man/geom_boxplot.Rd · 2026-05-07

The boxplot compactly displays the distribution of a continuous variable. It visualises five summary statistics (the median, two hinges and two whiskers), and all "outlying" points individually.

Aliases
geom_boxplotstat_boxplot
Usage
geom_boxplot( mapping = NULL, data = NULL, stat = "boxplot", position = "dodge2", ..., outliers = TRUE, outlier.colour = NULL, outlier.color = NULL, outlier.fill = NULL, outlier.shape = NULL, outlier.size = NULL, outlier.stroke = 0.5, outlier.alpha = NULL, whisker.colour = NULL, whisker.color = NULL, whisker.linetype = NULL, whisker.linewidth = NULL, staple.colour = NULL, staple.color = NULL, staple.linetype = NULL, staple.linewidth = NULL, median.colour = NULL, median.color = NULL, median.linetype = NULL, median.linewidth = NULL, box.colour = NULL, box.color = NULL, box.linetype = NULL, box.linewidth = NULL, notch = FALSE, notchwidth = 0.5, staplewidth = 0, varwidth = FALSE, na.rm = FALSE, orientation = NA, show.legend = NA, inherit.aes = TRUE ) stat_boxplot( mapping = NULL, data = NULL, geom = "boxplot", position = "dodge2", ..., orientation = NA, coef = 1.5, quantile.type = 7, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE )
Arguments
mapping
Set of aesthetic mappings created by [=aes]aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.
data
The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to [=ggplot]ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See [=fortify]fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).
position
A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following: The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position. A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter". For more information and other ways to specify the position, see the [=layer_positions]layer position documentation.
...
Other arguments passed on to [=layer]layer()'s params argument. These arguments broadly fall into one of 4 categories below. Notably, further arguments to the position argument, or aesthetics that are required can not be passed through .... Unknown arguments that are not part of the 4 categories below are ignored. Static aesthetics that are not mapped to a scale, but are at a fixed value and apply to the layer as a whole. For example, colour = "red" or linewidth = 3. The geom's documentation has an Aesthetics section that lists the available options. The 'required' aesthetics cannot be passed on to the params. Please note that while passing unmapped aesthetics as vectors is technically possible, the order and required length is not guaranteed to be parallel to the input data. When constructing a layer using a stat_*() function, the ... argument can be used to pass on parameters to the geom part of the layer. An example of this is stat_density(geom = "area", outline.type = "both"). The geom's documentation lists which parameters it can accept. Inversely, when constructing a layer using a geom_*() function, the ... argument can be used to pass on parameters to the stat part of the layer. An example of this is geom_area(stat = "density", adjust = 0.5). The stat's documentation lists which parameters it can accept. The key_glyph argument of [=layer]layer() may also be passed on through .... This can be one of the functions described as [=draw_key]key glyphs, to change the display of the layer in the legend.
outliers
Whether to display (TRUE) or discard (FALSE) outliers from the plot. Hiding or discarding outliers can be useful when, for example, raw data points need to be displayed on top of the boxplot. By discarding outliers, the axis limits will adapt to the box and whiskers only, not the full data range. If outliers need to be hidden and the axes needs to show the full data range, please use outlier.shape = NA instead.
outlier.colour, outlier.color, outlier.fill, outlier.shape, outlier.size, outlier.stroke, outlier.alpha
Default aesthetics for outliers. Set to NULL to inherit from the data's aesthetics.
whisker.colour, whisker.color, whisker.linetype, whisker.linewidth
Default aesthetics for the whiskers. Set to NULL to inherit from the data's aesthetics.
staple.colour, staple.color, staple.linetype, staple.linewidth
Default aesthetics for the staples. Set to NULL to inherit from the data's aesthetics. Note that staples don't appear unless the staplewidth argument is set to a non-zero size.
median.colour, median.color, median.linetype, median.linewidth
Default aesthetics for the median line. Set to NULL to inherit from the data's aesthetics.
box.colour, box.color, box.linetype, box.linewidth
Default aesthetics for the boxes. Set to NULL to inherit from the data's aesthetics.
notch
If FALSE (default) make a standard box plot. If TRUE, make a notched box plot. Notches are used to compare groups; if the notches of two boxes do not overlap, this suggests that the medians are significantly different.
notchwidth
For a notched box plot, width of the notch relative to the body (defaults to notchwidth = 0.5).
staplewidth
The relative width of staples to the width of the box. Staples mark the ends of the whiskers with a line.
varwidth
If FALSE (default) make a standard box plot. If TRUE, boxes are drawn with widths proportional to the square-roots of the number of observations in the groups (possibly weighted, using the weight aesthetic).
na.rm
If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.
orientation
The orientation of the layer. The default (NA) automatically determines the orientation from the aesthetic mapping. In the rare event that this fails it can be given explicitly by setting orientation to either "x" or "y". See the Orientation section for more detail.
show.legend
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, use TRUE. If NA, all levels are shown in legend, but unobserved levels are omitted.
inherit.aes
If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. [=annotation_borders]annotation_borders().
geom, stat
Use to override the default connection between geom_boxplot() and stat_boxplot(). For more information about overriding these connections, see how the [=layer_stats]stat and [=layer_geoms]geom arguments work.
coef
Length of the whiskers as multiple of IQR. Defaults to 1.5.
quantile.type
An integer between 1 and 9 setting the quantile algorithm per [stats:quantile]stats::quantile(type). Defaults to 7
Examples
p <- ggplot(mpg, aes(class, hwy)) p + geom_boxplot() # Orientation follows the discrete axis ggplot(mpg, aes(hwy, class)) + geom_boxplot() p + geom_boxplot(notch = TRUE) p + geom_boxplot(varwidth = TRUE) p + geom_boxplot(fill = "white", colour = "#3366FF") # By default, outlier points match the colour of the box. Use # outlier.colour to override p + geom_boxplot(outlier.colour = "red", outlier.shape = 1) # Remove outliers when overlaying boxplot with original data points p + geom_boxplot(outlier.shape = NA) + geom_jitter(width = 0.2) # Boxplots are automatically dodged when any aesthetic is a factor p + geom_boxplot(aes(colour = drv)) # You can also use boxplots with continuous x, as long as you supply # a grouping variable. cut_width is particularly useful ggplot(diamonds, aes(carat, price)) + geom_boxplot() ggplot(diamonds, aes(carat, price)) + geom_boxplot(aes(group = cut_width(carat, 0.25))) # Adjust the transparency of outliers using outlier.alpha ggplot(diamonds, aes(carat, price)) + geom_boxplot(aes(group = cut_width(carat, 0.25)), outlier.alpha = 0.1) # It's possible to draw a boxplot with your own computations if you # use stat = "identity": set.seed(1) y <- rnorm(100) df <- data.frame( x = 1, y0 = min(y), y25 = quantile(y, 0.25), y50 = median(y), y75 = quantile(y, 0.75), y100 = max(y) ) ggplot(df, aes(x)) + geom_boxplot( aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100), stat = "identity" )
See also
[=geom_quantile]geom_quantile() for continuous x, [=geom_violin]geom_violin() for a richer display of the distribution, and [=geom_jitter]geom_jitter() for a useful technique for small data.
Custom sections
Orientation
This geom treats each axis differently and, thus, can thus have two orientations. Often the orientation is easy to deduce from a combination of the given mappings and the types of positional scales in use. Thus, ggplot2 will by default try to guess which orientation the layer should have. Under rare circumstances, the orientation is ambiguous and guessing may fail. In that case the orientation can be specified directly using the orientation parameter, which can be either "x" or "y". The value gives the axis that the geom should run along, "x" being the default orientation you would expect for the geom.
Summary statistics
The lower and upper hinges correspond to the first and third quartiles (the 25th and 75th percentiles). This differs slightly from the method used by the [=boxplot]boxplot() function, and may be apparent with small samples. See [=boxplot.stats]boxplot.stats() for more information on how hinge positions are calculated for [=boxplot]boxplot(). The upper whisker extends from the hinge to the largest value no further than 1.5 * IQR from the hinge (where IQR is the inter-quartile range, or distance between the first and third quartiles). The lower whisker extends from the hinge to the smallest value at most 1.5 * IQR of the hinge. Data beyond the end of the whiskers are called "outlying" points and are plotted individually. In a notched box plot, the notches extend 1.58 * IQR / sqrt(n). This gives a roughly 95% confidence interval for comparing medians. See McGill et al. (1978) for more details.
Computed variables
These are calculated by the 'stat' part of layers and can be accessed with [=aes_eval]delayed evaluation. stat_boxplot() provides the following variables, some of which depend on the orientation: after_stat(width) width of boxplot. after_stat(ymin) or after_stat(xmin) lower whisker = smallest observation greater than or equal to lower hinger - 1.5 * IQR. after_stat(lower) or after_stat(xlower) lower hinge, 25% quantile. after_stat(notchlower) lower edge of notch = median - 1.58 * IQR / sqrt(n). after_stat(middle) or after_stat(xmiddle) median, 50% quantile. after_stat(notchupper) upper edge of notch = median + 1.58 * IQR / sqrt(n). after_stat(upper) or after_stat(xupper) upper hinge, 75% quantile. after_stat(ymax) or after_stat(xmax) upper whisker = largest observation less than or equal to upper hinger + 1.5 * IQR.
Aesthetics
geom_boxplot() understands the following aesthetics. Required aesthetics are displayed in bold and defaults are displayed for optional aesthetics: rll • [=aes_position]x or [=aes_position]y • lower or xlower • upper or xupper • middle or xmiddle • [=aes_position]ymin or [=aes_position]xmin • [=aes_position]ymax or [=aes_position]xmax • [=aes_colour_fill_alpha]alpha → NA • [=aes_colour_fill_alpha]colour → via theme() • [=aes_colour_fill_alpha]fill → via theme() • [=aes_group_order]group → inferred • [=aes_linetype_size_shape]linetype → via theme() • [=aes_linetype_size_shape]linewidth → via theme() • [=aes_linetype_size_shape]shape → via theme() • [=aes_linetype_size_shape]size → via theme() • weight → 1 • width → 0.9 Learn more about setting these aesthetics in vignette("ggplot2-specs").
Note
In the unlikely event you specify both US and UK spellings of colour, the US spelling will take precedence.
References
McGill, R., Tukey, J. W. and Larsen, W. A. (1978) Variations of box plots. The American Statistician 32, 12-16.

버전 이력

RepositoryVersionPublishedFirst seenLast seenDocs
CRAN4.0.22026-02-032026-05-092026-05-09
CRAN4.0.12025-11-142026-05-092026-05-09
CRAN4.0.02025-09-112026-05-092026-05-09
CRAN3.5.22025-04-092026-05-092026-05-09
CRAN3.5.12024-04-232026-05-092026-05-09
CRAN3.5.02024-02-232026-05-092026-05-09
CRAN3.4.42023-10-122026-05-092026-05-09
CRAN3.4.32023-08-142026-05-092026-05-09
CRAN3.4.22023-04-032026-05-092026-05-09
CRAN3.4.12023-02-102026-05-092026-05-09
CRAN3.4.02022-11-042026-05-092026-05-09
CRAN3.3.62022-05-032026-05-092026-05-09
CRAN3.3.52021-06-252026-05-092026-05-09
CRAN3.3.42021-06-162026-05-092026-05-09
CRAN3.3.32020-12-302026-05-092026-05-09
CRAN3.3.22020-06-192026-05-092026-05-09
CRAN3.3.12020-05-292026-05-092026-05-09
CRAN3.3.02020-03-052026-05-092026-05-09
CRAN3.2.12019-08-112026-05-092026-05-09
CRAN3.2.02019-06-162026-05-092026-05-09
CRAN3.1.12019-04-072026-05-092026-05-09
CRAN3.1.02018-10-252026-05-092026-05-09
CRAN3.0.02018-07-032026-05-092026-05-09
CRAN2.2.12016-12-302026-05-092026-05-09
CRAN2.2.02016-11-112026-05-092026-05-09
CRAN2.1.02016-03-012026-05-092026-05-09
CRAN2.0.02015-12-182026-05-092026-05-09
CRAN1.0.12015-03-172026-05-092026-05-09
CRAN1.0.02014-05-212026-05-092026-05-09
CRAN0.9.3.12013-03-022026-05-092026-05-09
CRAN0.9.32012-12-052026-05-092026-05-09
CRAN0.9.2.12012-09-112026-05-092026-05-09
CRAN0.9.22012-09-042026-05-092026-05-09
CRAN0.9.12012-05-082026-05-092026-05-09
CRAN0.9.02012-03-012026-05-092026-05-09
CRAN0.8.92010-12-232026-05-092026-05-09
CRAN0.8.82010-07-052026-05-092026-05-09
CRAN0.8.72010-03-022026-05-092026-05-09
CRAN0.8.62010-02-182026-05-092026-05-09
CRAN0.8.52009-12-162026-05-092026-05-09
CRAN0.8.42009-12-092026-05-092026-05-09
CRAN0.8.32009-04-202026-05-092026-05-09
CRAN0.8.22009-02-252026-05-092026-05-09
CRAN0.8.12008-12-142026-05-092026-05-09
CRAN0.82008-11-212026-05-092026-05-09
CRAN0.72008-10-052026-05-092026-05-09
CRAN0.62008-04-032026-05-092026-05-09
CRAN0.5.72008-01-112026-05-092026-05-09
CRAN0.5.62007-10-202026-05-092026-05-09
CRAN0.5.52007-09-012026-05-092026-05-09
CRAN0.5.42007-07-082026-05-092026-05-09
CRAN0.5.22007-06-182026-05-092026-05-09
CRAN0.5.12007-06-102026-05-092026-05-09
CRAN0.52007-06-012026-05-092026-05-09
CRAN4.0.32026-05-292026-05-30
R-universe4.0.3.90002026-05-292026-05-30

보안

표시할 OSV 데이터가 없습니다.

문헌 신호

표시할 OpenAlex 데이터가 없습니다.