ggplot2 Changelog

What's new in ggplot2 3.4.3

Aug 15, 2023
  • This hotfix release addresses a version comparison change in r-devel. There are
  • no user-facing or breaking changes.

New in ggplot2 3.4.2 (Apr 11, 2023)

  • This is a hotfix release anticipating changes in r-devel, but folds in upkeep
  • changes and a few bug fixes as well.
  • Minor improvements:
  • Various type checks and their messages have been standardised
  • (@teunbrand, #4834).
  • ggplot2 now uses scales::DiscreteRange and scales::ContinuousRange, which
  • are available to write scale extensions from scratch (@teunbrand, #2710).
  • The layer_data(), layer_scales() and layer_grob() now have the default
  • plot = last_plot() (@teunbrand, #5166).
  • The datetime_scale() scale constructor is now exported for use in extension
  • packages (@teunbrand, #4701).
  • Bug fixes:
  • update_geom_defaults() and update_stat_defaults() now return properly
  • classed objects and have updated docs (@dkahle, #5146).
  • For the purposes of checking required or non-missing aesthetics, character
  • vectors are no longer considered non-finite (@teunbrand, @4284).
  • annotation_logticks() skips drawing ticks when the scale range is non-finite
  • instead of throwing an error (@teunbrand, #5229).
  • Fixed spurious warnings when the weight was used in stat_bin_2d(),
  • stat_boxplot(), stat_contour(), stat_bin_hex() and stat_quantile()
  • (@teunbrand, #5216).
  • To prevent changing the plotting order, stat_sf() is now computed per panel
  • instead of per group (@teunbrand, #4340).
  • Fixed bug in coord_sf() where graticule lines didn't obey
  • panel.grid.major's linewidth setting (@teunbrand, #5179).
  • geom_text() drops observations where angle = NA instead of throwing an
  • error (@teunbrand, #2757).

New in ggplot2 3.4.1 (Feb 21, 2023)

  • Breaking changes
  • The computed variable y in stat_ecdf() has been superseded by ecdf to prevent incorrect scale transformations (@teunbrand, #5113 and #5112).
  • New features
  • Added scale_linewidth_manual() and scale_linewidth_identity() to support the linewidth aesthetic (@teunbrand, #5050).
  • ggsave() warns when multiple filenames are given, and only writes to the first file (@teunbrand, #5114).
  • Bug fixes
  • Fixed a regression in geom_hex() where aesthetics were replicated across bins (@thomasp85, #5037 and #5044).
  • Using two ordered factors as facetting variables in facet_grid(..., as.table = FALSE) now throws a warning instead of an error (@teunbrand, #5109).
  • Fixed misbehaviour of draw_key_boxplot() and draw_key_crossbar() with skewed key aspect ratio (@teunbrand, #5082).
  • Fixed spurious warning when weight aesthetic was used in stat_smooth() (@teunbrand based on @clauswilke's suggestion, #5053).
  • The lwd alias is now correctly replaced by linewidth instead of size (@teunbrand based on @clauswilke's suggestion #5051).
  • Fixed a regression in Coord$train_panel_guides() where names of guides were dropped (@maxsutton, #5063).
  • In binned scales
  • Automatic breaks should no longer be out-of-bounds, and automatic limits are adjusted to include breaks (@teunbrand, #5082).
  • Zero-range limits no longer throw an error and are treated akin to continuous scales with zero-range limits (@teunbrand, #5066).
  • The trans = "date" and trans = "time" transformations were made compatible (@teunbrand, #4217).

New in ggplot2 3.4.0 (Dec 1, 2022)

  • Breaking changes:
  • A linewidth aesthetic has been introduced and supersedes the size aesthetic for scaling the width of lines in line based geoms. size will remain functioning but deprecated for these geoms and it is recommended to update all code to reflect the new aesthetic. For geoms that have both point sizing and linewidth sizing (geom_pointrange() and geom_sf) size now only refers to sizing of points which can leads to a visual change in old code (@thomasp85, #3672)
  • The default line width for polygons in geom_sf() have been decreased to 0.2 to reflect that this is usually used for demarking borders where a thinner line is better suited. This change was made since we already induced a visual change in geom_sf() with the introduction of the linewidth aesthetic.
  • The dot-dot notation (..var..) and stat(), which have been superseded by after_stat(), are now formally deprecated (@yutannihilation, #3693).
  • qplot() is now formally deprecated (@yutannihilation, #3956).
  • stage() now properly refers to the values without scale transformations for the stage of after_stat. If your code requires the scaled version of the values for some reason, you have to apply the same transformation by yourself, e.g. sqrt() for scale_{x,y}_sqrt() (@yutannihilation and @teunbrand, #4155).
  • Use rlang::hash() instead of digest::digest(). This update may lead to changes in the automatic sorting of legends. In order to enforce a specific legend order use the order argument in the guide. (@thomasp85, #4458)
  • referring to x in backquoted expressions with label_bquote() is no longer possible.
  • The ticks.linewidth and frame.linewidth parameters of guide_colourbar() are now multiplied with .pt like elsewhere in ggplot2. It can cause visual changes when these arguments are not the defaults and these changes can be restored to their previous behaviour by adding / .pt (@teunbrand #4314).
  • scale_*_viridis_b() now uses the full range of the viridis scales (@gregleleu, #4737)
  • New features:
  • geom_col() and geom_bar() gain a new just argument. This is set to 0.5 by default; use just = 0/just = 1 to place columns on the left/right of the axis breaks. (@wurli, #4899)
  • geom_density() and stat_density() now support bounds argument to estimate density with boundary correction (@echasnovski, #4013).
  • ggplot now checks during statistical transformations whether any data columns were dropped and warns about this. If stats intend to drop data columns they can declare them in the new field dropped_aes. (@clauswilke, #3250)
  • ... supports rlang::list2 dynamic dots in all public functions. (@mone27, #4764)
  • theme() now has a strip.clip argument, that can be set to "off" to prevent the clipping of strip text and background borders (@teunbrand, #4118)
  • geom_contour() now accepts a function in the breaks argument (@eliocamp, #4652).
  • Minor improvements and bug fixes:
  • Fix a bug in position_jitter() where infinity values were dropped (@javlon, #4790).
  • geom_linerange() now respects the na.rm argument (#4927, @thomasp85)
  • Improve the support for guide_axis() on coord_trans() (@yutannihilation, #3959)
  • Added stat_align() to align data without common x-coordinates prior to stacking. This is now the default stat for geom_area() (@thomasp85, #4850)
  • Fix a bug in stat_contour_filled() where break value differences below a certain number of digits would cause the computations to fail (@thomasp85, #4874)
  • Secondary axis ticks are now positioned more precisely, removing small visual artefacts with alignment between grid and ticks (@thomasp85, #3576)
  • Improve stat_function documentation regarding xlim argument. (@92amartins, #4474)
  • Fix various issues with how labels, breaks, limits, and show.limits interact in the different binning guides (@thomasp85, #4831)
  • Automatic break calculation now squishes the scale limits to the domain of the transformation. This allows scale_{x/y}_sqrt() to find breaks at 0 when appropriate (@teunbrand, #980).
  • Using multiple modified aesthetics correctly will no longer trigger warnings. If used incorrectly, the warning will now report the duplicated aesthetic instead of NA (@teunbrand, #4707).
  • aes() now supports the !!! operator in its first two arguments (#2675). Thanks to @yutannihilation and @teunbrand for draft
  • implementations.
  • Require rlang >= 1.0.0 (@billybarc, #4797)
  • geom_violin() no longer issues "collapsing to unique 'x' values" warning (@bersbersbers, #4455)
  • annotate() now documents unsupported geoms (geom_abline(), geom_hline() and geom_vline()), and warns when they are requested (@mikmart, #4719)
  • presidential dataset now includes Trump's presidency (@bkmgit, #4703).
  • position_stack() now works fully with geom_text() (@thomasp85, #4367)
  • geom_tile() now correctly recognises missing data in xmin, xmax, ymin, and ymax (@thomasp85 and @sigmapi, #4495)
  • geom_hex() will now use the binwidth from stat_bin_hex() if present, instead of deriving it (@thomasp85, #4580)
  • geom_hex() now works on non-linear coordinate systems (@thomasp85)
  • Fixed a bug throwing errors when trying to render an empty plot with secondary axes (@thomasp85, #4509)
  • Axes are now added correctly in facet_wrap() when as.table = FALSE (@thomasp85, #4553)
  • Better compatibility of custom device functions in ggsave() (@thomasp85, #4539)
  • Binning scales are now more resilient to calculated limits that ends up being NaN after transformations (@thomasp85, #4510)
  • Strip padding in facet_grid() is now only in effect if strip.placement = "outside" and an axis is present between the strip andthe panel (@thomasp85, #4610)
  • Aesthetics of length 1 are now recycled to 0 if the length of the data is 0 (@thomasp85, #4588)
  • Setting size = NA will no longer cause guide_legend() to error (@thomasp85, #4559)
  • Setting stroke to NA in geom_point() will no longer impair the sizing of the points (@thomasp85, #4624)
  • stat_bin_2d() now correctly recognises the weight aesthetic (@thomasp85, #4646)
  • All geoms now have consistent exposure of linejoin and lineend parameters, and the guide keys will now respect these settings (@thomasp85, #4653)
  • geom_sf() now respects arrow parameter for lines (@JakeRuss, #4659)
  • Updated documentation for print.ggplot to reflect that it returns the original plot, not the result of ggplot_build(). (@r2evans, #4390)
  • scale_*_manual() no longer displays extra legend keys, or changes their order, when a named values argument has more items than the data. To display all values on the legend instead, use scale_*_manual(values = vals, limits = names(vals)). (@teunbrand, @banfai, #4511, #4534)
  • Updated documentation for geom_contour() to correctly reflect argument precedence between bins and binwidth. (@eliocamp, #4651)
  • Dots in geom_dotplot() are now correctly aligned to the baseline when stackratio != 1 and stackdir != "up" (@mjskay, #4614)
  • Key glyphs for geom_boxplot(), geom_crossbar(), geom_pointrange(), and geom_linerange() are now orientation-aware (@mjskay, #4732)
  • Updated documentation for geom_smooth() to more clearly describe effects of the fullrange parameter (@thoolihan, #4399).

New in ggplot2 3.3.6 (May 3, 2022)

  • This is a very small release only applying an internal change to comply with R 4.2 and its deprecation of default.stringsAsFactors(). There are no user facing changes and no breaking changes.

New in ggplot2 3.3.5 (Jun 25, 2021)

  • This is a very small release focusing on fixing a couple of untenable issues
  • That surfaced with the 3.3.4 release:
  • Revert changes made in #4434 (apply transform to intercept in geom_abline())
  • as it introduced undesirable issues far worse than the bug it fixed
  • (@thomasp85, #4514)
  • Fixes an issue in ggsave() when producing emf/wmf files (@yutannihilation,
  • #4521)
  • Warn when grDevices specific arguments are passed to ragg devices (@thomasp85,
  • #4524)
  • Fix an issue where coord_sf() was reporting that it is non-linear
  • even when data is provided in projected coordinates (@clauswilke, #4527)

New in ggplot2 3.3.4 (Jun 17, 2021)

  • Fix a bug that after_stat() and after_scale() cannot refer to aesthetics
  • if it's specified in the plot-global mapping (@yutannihilation, #4260).
  • Fix bug in annotate_logticks() that would cause an error when used together with coord_flip() (@thomasp85, #3954)
  • Fix a bug in geom_abline() that resulted in intercept not being subjected
  • to the transformation of the y scale (@thomasp85, #3741)
  • Extent the range of the line created by geom_abline() so that line ending
  • is not visible for large linewidths (@thomasp85, #4024)
  • Fix bug in geom_dotplot() where dots would be positioned wrong with
  • stackgroups = TRUE (@thomasp85, #1745)
  • Fix calculation of confidence interval for locfit smoothing in geom_smooth()
  • (@topepo, #3806)
  • Fix bug in geom_text() where "outward" and "inward" justification for
  • some angle values was reversed (@aphalo, #4169, #4447)
  • ggsave() now sets the default background to match the fill value of the
  • plot.background theme element (@karawoo, #4057)
  • It is now deprecated to specify guides(<scale> = FALSE) or
  • scale_*(guide = FALSE) to remove a guide. Please use
  • guides(<scale> = "none") or scale_*(guide = "none") instead
  • (@yutannihilation, #4094).
  • Fix a bug in guide_bins() where keys would disappear if the guide was
  • reversed (@thomasp85, #4210)
  • Fix bug in guide_coloursteps() that would repeat the terminal bins if the
  • breaks coincided with the limits of the scale (@thomasp85, #4019)
  • Make sure that default labels from default mappings doesn't overwrite default labels from explicit mappings (@thomasp85, #2406)
  • Fix bug in labeller() where parsing was turned off if .multiline = FALSE
  • (@thomasp85, #4084)
  • Make sure label_bquote() has access to the calling environment when
  • evaluating the labels (@thomasp85, #4141)
  • Fix a bug in the layer implementation that introduced a new state after the
  • first render which could lead to a different look when rendered the second
  • time (@thomasp85, #4204)
  • Fix a bug in legend justification where justification was lost of the legend
  • dimensions exceeded the available size (@thomasp85, #3635)
  • Fix a bug in position_dodge2() where NA values in thee data would cause an error (@thomasp85, #2905)
  • Make sure position_jitter() creates the same jittering independent of
  • whether it is called by name or with constructor (@thomasp85, #2507)
  • Fix a bug in position_jitter() where different jitters would be applied to
  • different position aesthetics of the same axis (@thomasp85, #2941)
  • Fix a bug in qplot() when supplying c(NA, NA) as axis limits
  • (@thomasp85, #4027)
  • Remove cross-inheritance of default discrete colour/fill scales and check the type and aesthetic of function output if type is a function
  • (@thomasp85, #4149)
  • Fix bug in scale_[x|y]_date() where custom breaks functions that resulted in fracional dates would get misaligned (@thomasp85, #3965)
  • Fix bug in scale_[x|y]_datetime() where a specified timezone would be
  • ignored by the scale (@thomasp85, #4007)
  • Fix issue in sec_axis() that would throw warnings in the absence of any
  • secondary breaks (@thomasp85, #4368)
  • stat_bin()'s computed variable width is now documented (#3522).
  • stat_count() now computes width based on the full dataset instead of per
  • group (@thomasp85, #2047)
  • Extended stat_ecdf() to calculate the cdf from either x or y instead from y
  • only (@jgjl, #4005)
  • Fix a bug in stat_summary_bin() where one more than the requested number of bins would be created (@thomasp85, #3824)
  • Only drop groups in stat_ydensity() when there are fewer than two data
  • points and throw a warning (@andrewwbutler, #4111).
  • Fixed a bug in strip assembly when theme has strip.text = element_blank()
  • and plots are faceted with multi-layered strips (@teunbrand, #4384).
  • Using theme(aspect.ratio = ...) together with free space in facet_grid()
  • now crrectly throws an error (@thomasp85, #3834)
  • Fixed a bug in labeller() so that .default is passed to as_labeller()
  • when labellers are specified by naming faceting variables. (@waltersom, #4031)
  • Updated style for example code (@rjake, #4092)
  • ggplot2 now requires R >= 3.3 (#4247).
  • ggplot2 now uses rlang::check_installed() to check if a suggested package is installed, which will offer to install the package before continuing (#4375, @malcolmbarrett)
  • Improved error with hint when piping a ggplot object into a facet function
  • (#4379, @mitchelloharawild).

New in ggplot2 3.3.3 (Jan 9, 2021)

  • This is a small patch release mainly intended to address changes in R and CRAN.
  • It further changes the licensing model of ggplot2 to an MIT license.
  • Update the ggplot2 licence to an MIT license (#4231, #4232, #4233, and #4281)
  • Use vdiffr conditionally so ggplot2 can be tested on systems without vdiffr
  • Update tests to work with the new all.equal() defaults in R >4.0.3