Skip to content

ggformula

2.0.0Package record

Formula Interface to the Grammar of Graphics

5packages dependsuggested by 5
197.2Kdownloads / year
50.1%test coverage
13/13flavors OK

Overview

About

Provides a formula interface to 'ggplot2' graphics.

Changes in 2.0.0
  • layer_factory(), the core function that creates gf_*() functions, has been largely refactored. Most existing behavior

remains unchanged (aside from bug fixes).

  • New feature: aesthetics that are normally supplied via the formula can now also be supplied as named arguments using formula syntax, e.g. gf_point(x = ~var1, y = ~var2, data = df) works like gf_point(var2 ~ var1, data = df). This generalizes to every gf_* function's formula "roles", not just x/y (for example gf_ribbon(ymin = ~lo, ymax = ~hi, x = ~t, data = df) works like gf_ribbon(lo + hi ~ t, data = df)). If a role is supplied both via a literal formula and as a named argument, the named argument wins and a warning is emitted.
  • It is now easier to create wrappers around additional stats and geoms. There is a vignette describing how to do so.
Show all changes in 2.0.0Hide the rest of the changes in 2.0.0
  • New feature: layer_factory() gains a required_packages argument for

extension-package authors. Naming one or more packages there (e.g.

required_packages = "ggforce") checks, before anything else runs

(including pre), that each is both installed and attached (via

library()), raising an informative error otherwise. This replaces the

hand-written pre-block checks previously used internally, e.g. in

gf_sina(); see the new "Extending ggformula" vignette

(vignette("extending-ggformula")) for details. required_packages is

also recorded in a function's ggformula_spec().

  • New feature: layer_factory() also gains installed_packages, a lighter-weight sibling of required_packages that only checks that a package is installed, not that it's attached -- the right fit for functions (built with the layer_fun = pattern) that call an extension package's function directly via pkg::fun(). gf_sf() now uses installed_packages = "sf" instead of its hand-written pre check. Also recorded in ggformula_spec().
  • Attaching a package that imports

ggformula (e.g., mosaic) prevents dependencies of

ggformula from being attached, even when ggformula

is subsequently attached with library(ggformula). This

caused some behavior to break with unclear messaging unless the user explicitly attached dependencies of ggformula (e.g., ggiraph). This should now be fixed via a combination of mechanisms.

  • Bug fix: inherit = FALSE was silently ignored by gf_*() functions built with an explicit layer_fun naming a geom_*() constructor rather than the default ggplot2::layer() -- most visibly gf_violin(), which adopted layer_fun = ggplot2::geom_violin in 1.1.0. inherit.aes is now forwarded whenever the layer function declares it, so gf_violin(..., inherit = FALSE) again creates a layer that does not inherit the plot's aesthetics. gf_abline(), gf_hline(), and gf_vline() are unaffected: they are built with inherit.aes = FALSE, matching those geoms' own defaults.
  • Bug fix: relatedly, inherit = FALSE was ignored by every gf_*_interactive() function, since those are built on layer_interactive() rather than ggplot2::layer(). layer_interactive() now accepts and forwards inherit.aes, so e.g. gf_point_interactive(..., inherit = FALSE) behaves like gf_point(..., inherit = FALSE). When not supplied, inherit.aes is omitted rather than forwarded as NULL, leaving the underlying geom's own default in force.
  • The vignette on interactive functions has been moved out of the package and only appears on the pkgdown site to reduce the size of the package.
  • The tutorials have been converted to webr.
  • Bug fix: gf_hline(), gf_vline(), gf_abline(), and similar functions used with data = NA (i.e., with all values supplied directly rather than from a data frame) could error or silently pass duplicated/incorrect arguments (such as position) down to the underlying geom, because argument names shared with ggplot2's geom_*()/stat_*() constructors (data, mapping, position, show.legend, inherit.aes, geom, stat) were incorrectly treated as generic settable parameters. This also fixed a related failure in some gf_*_interactive() layers (e.g. gf_jitter_interactive(width = ...)) that could error with "Both position and width/height were supplied."
  • Bug fix: replaced remaining internal use of the removed/deprecated aes_string() (used only in the data = NA code path above) with a tidy-eval equivalent.
  • Internal refactor: the body of the function created by layer_factory() (used to build every gf_* function) has been decomposed into small, individually documented helper functions, one per stage of the "formula -> ggplot2 layer" pipeline. This is intended to make the code easier to read, test, and extend; no behavior changes are intended from this refactor alone.
  • Internal: every function created by layer_factory() now records an explicit, documented specification (retrieved with the new ggformula_spec()) of the geom, stat, position, aes_form, extras, pre, aesthetics, inherit.aes, check.aes, required_packages, and installed_packages it was built with. interactive_layer_factory() now reads that single documented record instead of scraping several loosely-related bindings out of a gf_* function's environment, and extension packages can use it too.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 9.6 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-09-16
  • NOTE12 OK, 1 NOTE2026-07-11
  • OK13 OK2026-06-09
  • ERROR12 OK, 1 ERROR2026-06-08
  • OK13 OK2026-05-02
Show 2 earlier changesHide 2 earlier changes
  • ERROR11 OK, 1 ERROR2026-04-25
  • NOTE11 OK, 3 NOTE2026-03-10
Advisories

none known

Documentation

In release 2.0.0
README· In the repository, left out of the releaseVignettesYes · 3 · dynamicNEWSYes · 100% structured · mentions 2.0.0Citation fileNo
Help pages
113 (2 internal)includes a package overview page
Examples that run
99%100 run in a plain check (1 of them under a condition) · 1 never run
Exported functions with examples
91%
Documented parameters
91%
Return-value docs
81%
Help pages citing references
3%

Downloads

197.2K
CRAN downloads in the past year
Rank #937 · ~540/day · ~16.4K/mo
Daily download trend is not available in this view yet.
15.8K30 days
44.2K90 days
197.2K1 year
Compare downloads with other packages →
Also on1.4K r2u125 autocran4.8K conda_forge197 c2d4u

Repository

38Stars
14Forks
12Open issues
0Open PRs
18Releases
977Commits
10Commit identities
977 commits · Last activity 2026-09-10
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
76
Median days to close, 50 most recently updated closed PRs
55

Stars over time

2024-09-20 · 382026-07-07 · 38
PracticesBeta

13 development-tooling and community-health practices detected across 6 families in the upstream repository

Checks run against github.com/projectmosaic/ggformula on 2026-10-18.

Continuous integration (3)
GitHub ActionsR CMD check workflowTravis CI (config file)

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.RmdpkgdownQuarto project

GitHub Pages site last deployed 2026-09-10

Coverage (1)
Coverage reporting (Codecov)
Reproducibility and dev environment (1)
data-raw/
Show all practicesHide 2 practices
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Lint, format, editor (2)
AirRStudio project
How this is detected·Detection ruleset v3 (2026-09-26)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen 2026-07-01
    Named in .Rbuildignore: .claude
    Named in .gitignore: .claude
    Commits: at least 12 crediting it in the message
Shared conventions any agent may read, so they name no particular tool.
Seen in the repository: AGENTS.md
From outside contributors
  • Claude Code
    Pull requests: 1 from outside contributors, first on 2026-07-02, 1 from forks
Models named in its commits
  • Claude Sonnet 511 commits · Sep 2026
  • Claude Sonnet 4.61 commit · Jul 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
36 external dependencies (excludes base and recommended)

Installing ggformula adds 73 packages (37 with compiled code, 61 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, bslib 5.6 MB.

Depends (5)
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
5direct
17indirect
Imports 5
Suggested by 5
Depends, Imports or LinkingTo, most downloaded first
Suggests, most downloaded first

Datasets

People & History

People (2)
Author, Maintainer · added in 0.5
Author · added in 0.5

Maintainer since 0.4.0 (2017)

Releases (20)

Pick two releases to compare their code metrics.

  • 2.0.0Latest
    record
    2026-09-11 · current release · diff ↗ ·
    added 1 export
    ggformula_spec
  • R
    R 4.6.0 released · 2026-04-24
  • 1.0.1
    record
    2026-01-17 · diff ↗
  • 1.0.0
    record
    2025-10-06 · diff ↗ ·
    added 50 exports
    gf_abline_interactive, gf_area_interactive, gf_bar_interactive, gf_bin2d_interactive, gf_bin_2d, gf_bin_2d_interactive, gf_boxplot_interactive, gf_col_interactive, gf_contour_filled_interactive, gf_contour_interactive, gf_count_interactive, gf_crossbar_interactive, gf_curve_interactive, gf_density2d_filled_interactive, gf_density2d_interactive, gf_density_2d_filled_interactive, gf_density_2d_interactive, gf_density_interactive, gf_dotplot_interactive, gf_errorbar_interactive, gf_facet_grid_interactive, gf_facet_wrap_interactive, gf_freqpoly_interactive, gf_girafe, gf_hex_interactive, gf_histogram_interactive, gf_hline_interactive, gf_jitter_interactive, gf_label_interactive, gf_labeller_interactive and 20 more
  • 0.12.2
    record
    2025-07-31 · diff ↗ ·
    removed 1 export
    gf_dhistogramh
    added 2 exports
    gf_annotate, gf_guides
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • 0.12.0
    record
    2023-11-09 · diff ↗ ·
    removed 5 exports
    %>%, StatSina, geom_sina, gf_histogramh, stat_sina
  • R
    R 4.3.0 released · 2023-04-21
  • 0.10.4
    record
    2023-04-11 · diff ↗
  • 0.10.2
    record
    2022-09-01 · diff ↗
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • 0.10.1
    record
    2021-01-13 · diff ↗ ·
    added 17 exports
    var_label<-, get_variable_labels, gf_contour_filled, gf_dens2, gf_density2d_filled, gf_density_2d_filled, gf_density_ridgeline_gradient, gf_density_ridges, gf_density_ridges2, gf_density_ridges_gradient, gf_plot, gf_relabel, gf_ridgeline, percs_by_group, props_by_group, set_variable_labels, var_label
  • R
    R 4.0.0 released · 2020-04-24
  • 0.9.4
    record
    2020-03-04 · diff ↗
Show 14 earlier eventsHide 14 earlier events
  • 0.9.3
    record
    2020-02-12 · diff ↗ ·
    added 4 exports
    StatSina, geom_sina, gf_sina, stat_sina
  • 0.9.2
    record
    2019-09-05 · diff ↗ ·
    added 4 exports
    discrete_breaks, gf_ecdf, gf_ellipse, gf_summary
  • R
    R 3.6.0 released · 2019-04-26
  • 0.9.1
    record
    2019-01-12 · diff ↗
  • 0.9.0
    record
    2018-08-03 · diff ↗ ·
    added 21 exports
    gf_barh, gf_bin2d, gf_boxploth, gf_colh, gf_countsh, gf_crossbarh, gf_dhistogramh, gf_fun2d, gf_fun_2d, gf_fun_contour, gf_fun_tile, gf_function2d, gf_function_2d, gf_function_contour, gf_function_tile, gf_histogramh, gf_linerangeh, gf_percentsh, gf_pointrangeh, gf_propsh, gf_violinh
  • 0.8.0
    record
    2018-06-26 · diff ↗ ·
    added 3 exports
    gf_empty, gf_sf, layer_factory
  • 0.7.0
    record
    2018-05-22 · diff ↗ ·
    added 3 exports
    gf_polygon, gf_rugx, gf_rugy
  • R
    R 3.5.0 released · 2018-04-23
  • 0.6.2
    record
    2018-02-06 · diff ↗ ·
    added 2 exports
    gf_percents, gf_props
  • 0.6.1
    record
    2018-01-03 · diff ↗ ·
    added 3 exports
    StatFitdistr, gf_fitdistr, stat_fitdistr
  • 0.6
    record
    2017-08-26 · diff ↗ ·
    added 1 export
    na.warn
  • 0.5
    record
    2017-07-24 · diff ↗ ·
    added 19 exports
    GeomLm, StatAsh, StatLm, StatQqline, StatSpline, geom_ash, geom_lm, geom_spline, gf_ash, gf_blank, gf_dhistogram, gf_dist, gf_qqline, gf_qqstep, makeFun, stat_ash, stat_lm, stat_qqline, stat_spline
  • 0.4.0
    record
    2017-06-22
  • R
    R 3.4.0 released · 2017-04-21

Package metadata

First published
2017-06-22
Total releases
20 / 9 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 4.1
Bundled data
1.3 KB / 1 file
Download size
6.0 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("ggformula")
Pruim, R., & Kaplan, D. (2026). ggformula: Formula Interface to the Grammar of Graphics (Version 2.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.ggformula

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for ggformula version 2.0.0 [Data set]. HJJB, LLC. Data release v2026-10-22. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy