ggformula 2.0.0
layer_factory(), the core function that createsgf_*()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 likegf_point(var2 ~ var1, data = df). This generalizes to everygf_*function’s formula “roles”, not justx/y(for examplegf_ribbon(ymin = ~lo, ymax = ~hi, x = ~t, data = df)works likegf_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.
- New feature:
layer_factory()gains arequired_packagesargument for extension-package authors. Naming one or more packages there (e.g.required_packages = "ggforce") checks, before anything else runs (includingpre), that each is both installed and attached (vialibrary()), raising an informative error otherwise. This replaces the hand-writtenpre-block checks previously used internally, e.g. ingf_sina(); see the new “Extending ggformula” vignette (vignette("extending-ggformula")) for details.required_packagesis also recorded in a function’sggformula_spec().
- New feature:
New feature:
layer_factory()also gainsinstalled_packages, a lighter-weight sibling ofrequired_packagesthat only checks that a package is installed, not that it’s attached – the right fit for functions (built with thelayer_fun =pattern) that call an extension package’s function directly viapkg::fun().gf_sf()now usesinstalled_packages = "sf"instead of its hand-writtenprecheck. Also recorded inggformula_spec().Attaching a package that imports
ggformula(e.g.,mosaic) prevents dependencies ofggformulafrom being attached, even whenggformulais subsequently attached withlibrary(ggformula). This caused some behavior to break with unclear messaging unless the user explicitly attached dependencies ofggformula(e.g.,ggiraph). This should now be fixed via a combination of mechanisms.Bug fix:
inherit = FALSEwas silently ignored bygf_*()functions built with an explicitlayer_funnaming ageom_*()constructor rather than the defaultggplot2::layer()– most visiblygf_violin(), which adoptedlayer_fun = ggplot2::geom_violinin 1.1.0.inherit.aesis now forwarded whenever the layer function declares it, sogf_violin(..., inherit = FALSE)again creates a layer that does not inherit the plot’s aesthetics.gf_abline(),gf_hline(), andgf_vline()are unaffected: they are built withinherit.aes = FALSE, matching those geoms’ own defaults.Bug fix: relatedly,
inherit = FALSEwas ignored by everygf_*_interactive()function, since those are built onlayer_interactive()rather thanggplot2::layer().layer_interactive()now accepts and forwardsinherit.aes, so e.g.gf_point_interactive(..., inherit = FALSE)behaves likegf_point(..., inherit = FALSE). When not supplied,inherit.aesis omitted rather than forwarded asNULL, 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 withdata = NA(i.e., with all values supplied directly rather than from a data frame) could error or silently pass duplicated/incorrect arguments (such asposition) down to the underlying geom, because argument names shared with ggplot2’sgeom_*()/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 somegf_*_interactive()layers (e.g.gf_jitter_interactive(width = ...)) that could error with “Bothpositionandwidth/heightwere supplied.”Bug fix: replaced remaining internal use of the removed/deprecated
aes_string()(used only in thedata = NAcode path above) with a tidy-eval equivalent.Internal refactor: the body of the function created by
layer_factory()(used to build everygf_*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 newggformula_spec()) of thegeom,stat,position,aes_form,extras,pre,aesthetics,inherit.aes,check.aes,required_packages, andinstalled_packagesit was built with.interactive_layer_factory()now reads that single documented record instead of scraping several loosely-related bindings out of agf_*function’s environment, and extension packages can use it too.
ggformula 1.0.1
CRAN release: 2026-01-17
- Fixes issues with documentation after an update to {ggplot2}.
ggformula 1.0.0
CRAN release: 2025-10-06
- Added support for interactive graphics based on {ggiraph}.
- Modifications to support {ggplot2} version 4.0.
ggformula 0.12.2
CRAN release: 2025-07-31
- Added
gf_guides()andgf_annotate(). - Bug fix in GeomLm to avoid warning about deprecated size aesthetic.
- Deprecated functions that relied on ggstance (no longer supported) have been made defunct.
- Updated documentation according to new CRAN policies.
ggformula 0.12.0
CRAN release: 2023-11-09
- Removed dependency on ggstance so that ggformula can work with WebR
- Deprecated horizontal versions of many plotting functions to remove dependence on ggstance and because ggplot2 now supports horizontal versions of most geoms.
- Examples have been updated to use
|>rather than%>% - Updates to documentation (formatting mostly)
- Bug fix: found one remaining use of
stat()and changed toafter_stat()
ggformula 0.10.4
CRAN release: 2023-04-11
- Updated the re-export of a few functions from
labelled. (#160) - Migrated from
stat()toafter_stat()to avoid deprecation notices fromggplot2. (#156) - Migrated from
sizetolinewidthfor line-like geoms to avoid deprecation notices fromggplot2. (#155)
ggformula 0.10.2
CRAN release: 2022-08-31
- Added improvements to
gf_hline(), etc. responding to changes in {ggplot2}. See #128. - Added support for nonsyntactic names in formulas. Among other things, this allows for using backticks around such names. See #152 and #153
- Added examples of
gf_lm()with non-default models.
ggformula 0.10.0
- Added
gf_ridgeline(),gf_ridgeline_gradient(),gf_density_ridges(),gf_density_ridges_gradient(). -
gf_dens()now usesgeom = "geom_density_line". This allows setting fill. - Plots now label variables with labels created in data using
labelled,expssorHmisclabeling functions - To reduce the size of the package, the main vignette has been shortened. The full version is available at https://www.mosaic-web.org/ggformula/.
- Two other vignettes have been moved to online only for the same reason.
ggformula 0.9.2
CRAN release: 2019-09-05
- Some internals in
layer_factory()have been reimplemented to avoid making copies of ggplot2 functions at compile time. This should make things more stable when updating ggplot2 but not updating ggformula. - Two new graphing functions were added:
gf_ellipse()andgf_ecdf() -
gf_rugx()andgf_label()have been modified a bit to make them easier to use. - Evaluation environments are now handled more stably. Instead of using the environment of the formula, the
environmentargument is used. After some delay, this completes the migration to ggplot2 version 2.2 (#96, #125) - Bug fix in
gf_dist()to avoid an error when usingparams. (#119) - Default in
gf_errorbar()is nowinherit = TRUE. The old default was required due to inconvenient naming of aesthetics ingeom_errorbar(), but those names have been changed now. (#120) - New function:
discrete_breaks().
ggformula 0.9.1
CRAN release: 2019-01-12
This release includes a few minor improvements, including
- Updated examples so they work better with pkgdown
- Other document improvements
ggformula 0.9.0
CRAN release: 2018-08-03
-
ggformulanow requiresggplot2 (>= 3.0.0). This should take care of issues in 0.8.0 whenggplot2was upgraded after upgradingggformula. -
pkgdownwebsite created at https://www.mosaic-web.org/ggformula/ - Several horizontal versions of geom and stats are implemented using
ggstance. -
vdiffris used for testing plot output
ggformula 0.8.0
CRAN release: 2018-06-26
The internals of all of the
gf_functions have been modified to make them work withggplot2version 2.3. In future releases, a versionggplot2at least this new will be required.The default value for
seingf_smooth()has been changed fromTRUEtoFALSE.gf_sf()added to support simple features data for maps.improved documentation and examples
ggformula 0.7.0
CRAN release: 2018-05-22
- Formulas of the shape
y ~ .can be used for plots that require ayaesthetic but noxaesthetic. - Added
gf_rugx()andgf_rugy(). Also additional examples using rugs are given in the documentation. - Added
gf_polygon()for simple maps. (Improved mapping capabilities should be coming whenggplot2hits version 2.3.) - Some internals have been reworked to improve the processing of arguments and deciding when to display the quick help for plotting functions.
- Modifications to the environments in which some functions are evaluated.
ggformula 0.6.2
CRAN release: 2018-02-06
- Improved scoping of
gf_functions makes it easier to work with data in the global environment. - New functions
gf_props()andgf_percents()added to simplify creating bar graphs on a proportion or percent scale. - New arguments
xlab,ylab,title,subtitle, andcaptionadded togf_functions. In the case ofgf_props()andgf_percents()these are prepopulated with defaults of “proportion” and “percent” to give nicer labeling of the plot. - The use of
weatherDatahas been removed since that package is no longer on CRAN - Improvements to
gf_abline(),gf_hline(), andgf_vline()expand the usable portion of the API. - Additional examples for some functions.
ggformula 0.6.1
CRAN release: 2018-01-03
Minor update primarily to support vignette data sets moving from StatisticalModeling to mosaicModel.
- Also added
gf_fitdistr().
ggformula 0.6.0
Mostly minor changes:
- Improved documentation of gf_ functions.
- na.warn() is now re-exported.
- Bug fix in gf_violin().
- Reformatted quick help messages.
ggformula 0.5.0
For version 0.5, the internals of ggformula have been largely redesigned to allow implementation of some new features. The new version relies much less on string parsing.
-
Some important changes to formula parsing include
-
attribute:valueandattribute::expressionare no longer supported within the main formula. - In exchange, things like
gf_point(1:10 ~ 1:10)work, making it simpler to create on the fly plots without having to build a data frame first. -
y ~ 1is equivalent to~ yin functions that allow the~ yformula shape. Example:gf_histogram(age ~ 1)andgf_histogram( ~ age)are equivalent
-
-
Some new functions have been added
-
gf_dist()can plot distributions -
gf_dhistogram()plots density histograms by default -
gf_ash()creates ASH plots
-
df_stats()has been improved to handle one-sided formulas better.Secondary layers are now able to inherit both data and formula-defined attributes from the primary layer. Use
inherit = FALSEif you don’t want inheritance. (A few functions haveinherit = FALSEas their default because it seems unlikely that inheriting will be desireable.)
ggformula 0.4.0
CRAN release: 2017-06-21
Version 0.4.0 constitutes a stable beta release. Changes to the API are still possible, but more likely future changes will focus on expansion of the suite of functions supplied, changes to the internal implementation, and improved documentation.
- Separated
ggformulafromstatisticalModeling. - Added support for many more geoms.
- Improved parsing of formulas. This is still a bit clunky since the order of operations in R formulas does not match what we would prefer in this package.
-
datamay now be an expression (likedata = KidsFeet %>% filter(sex == "G")) - Added support for geoms that have different required aesthetics.
- Added support for functions that allow more than one formula shape. Example:
gf_histogram()accepts formulas with shape~ xory ~ x. This makes it possible to create density histograms withgf_histogram(). - Parentheses now halt parsing of formulas. This allows for on-the-fly computations in formulas. Typically these computed expressions must be within parentheses to avoid formula expansion.
- Use
::to indicate mapping aesthetics. (:will autodetect, but only if the value is the name of a variable in the data set.) This should be considered experimental. - Added wrappers
gf_lims(),gf_labs(),gf_theme(),gf_facet_grid(),gf_facet_wrap() - Added
gf_refine()which can be used to pass by chaining anything that would have been “added” inggplot2 - Expanded and improved vignette describing use of the package.
- Added two tutorials.
- Added “quick help” for plotting functions.
- Added
gf_lm(), which isgf_smooth()withmethod = "lm" - Added
gf_dens()which isgf_line()withstat = "density".
