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
as it introduced undesirable issues far worse than the bug it fixed
- Fixes an issue in
ggsave()when producing emf/wmf files (@yutannihilation,
- Warn when grDevices specific arguments are passed to ragg devices (@thomasp85,
- Fix an issue where
coord_sf()was reporting that it is non-linear
even when data is provided in projected coordinates (@clauswilke, #4527)
This is a larger patch release fixing a huge number of bugs and introduces a
small selection of feature refinements.
Alt-text can now be added to a plot using the
+ labs(alt = ...). Currently this alt text is not automatically propagated,
but we plan to integrate into Shiny, RMarkdown, and other tools in the future.
coord_sf()now has an argument
default_crsthat specifies the coordinate
reference system (CRS) for non-sf layers and scale/coord limits. This argument
NULL, which means non-sf layers are assumed to be in projected
coordinates, as in prior ggplot2 versions. Setting
default_crs = sf::st_crs(4326)
provides a simple way to interpret x and y positions as longitude and latitude,
regardless of the CRS used by
coord_sf(). Authors of extension packages
stat_sf()-like functionality are encouraged to look at the source
compute_group()function to see how to provide scale-limit
The scale arguments
oobnow accept purrr style lambda notation (@teunbrand, #4427). The same
is true for
as_labeller()(and therefore also
stat_bin()'s computed variable
widthis now documented (#3522).
ggplot2 now requires R >= 3.3 (#4247).
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.
This is a small release focusing on fixing regressions introduced in 3.3.1.
Facet strips now have dedicated position-dependent theme elements
strip.text.y.right) that inherit from
respectively. As a consequence, some theme stylings now need to be applied to
the position-dependent elements rather than to the parent elements. This
change was already introduced in ggplot2 3.3.0 but not listed in the
changelog. (@thomasp85, #3683)
A newly added
geom_function()is now recommended to use in conjunction
stat_function(). In addition,
works with transformed y axes, e.g.
scale_y_log10(), and in plots
containing no other data or layers (@clauswilke, #3611, #3905, #3983).
Default discrete color scales are now configurable through the
ggplot2.discrete.fill. When set to a character
vector of colour codes (or list of character vectors) with sufficient length,
these colours are used for the default scale. See
for more details and examples (@cpsievert, #3833).
Default continuous colour scales (i.e., the
ggplot2.continuous.fill, which inform the
now accept a function, which allows more control over these default
continuous_scale()s (@cpsievert, #3827).
This is a minor release but does contain a range of substantial new features,
along with the standard bug fixes. The release contains a few visual breaking
changes, along with breaking changes for extension developers due to a shift in
internal representation of the position scales and their axes. No user breaking
changes are included.
This release also adds Dewey Dunnington (@paleolimbot) to the core team.
There are no user-facing breaking changes, but a change in some internal
representations that extension developers may have relied on, along with a few
breaking visual changes which may cause visual tests in downstream packages to
panel_paramsfield in the
Layoutnow contains a list of list of
ViewScaleobjects, describing the trained coordinate system scales, instead
of the list object used before. Any extensions that use this field will likely
break, as will unit tests that checks aspects of this.
geom_ribbon()now draws separate lines for the upper and lower intervals if
colouris mapped. Similarly,
the upper lines only in the same case by default. If you want old-style full
outline.type = "full"(@yutannihilation, #3503 / @thomasp85, #3708).
The evaluation time of aesthetics can now be controlled to a finer degree.
after_stat()supersedes the use of
..var..-notation, and is
after_scale()to allow for mapping to scaled aesthetic values.
Remapping of the same aesthetic is now supported with
stage(), so you can
map a data variable to a stat aesthetic, and remap the same aesthetic to
something else after statistical transformation (@thomasp85, #3534)
ylimarguments now accept
NAas a placeholder for the minimum or maximum value
ylim = c(0, NA)would zoom the y-axis from 0 to the
maximum value observed in the data). This mimics the behaviour
limitsargument in continuous scale functions
All geoms and stats that had a direction (i.e. where the x and y axes had
different interpretation), can now freely choose their direction, instead of
coord_flip(). The direction is deduced from the aesthetic
mapping, but can also be specified directly with the new
argument (@thomasp85, #3506).
Position guides can now be customized using the new
guide_axis(), which can
be passed to position
scale_*()functions or via
guides(). The new axis
guide_axis()) comes with arguments
of overlapping labels),
angle(easy rotation of axis labels), and
n.dodge(dodge labels into multiple rows/columns) (@paleolimbot, #3322).
A new scale type has been added, that allows binning of aesthetics at the
scale level. It has versions for both position and non-position aesthetics and
comes with two new guides (
geom_contour_filled(), which compute
and draw filled contours of gridded data (@paleolimbot, #3044).
stat_contour()now use the isoband package
to compute contour lines. The
completeparameter (which was undocumented
and has been unused for at least four years) was removed (@paleolimbot, #3044).
Themes have gained two new parameters,
plot.caption.position, that can be used to customize how plot
title/subtitle and plot caption are positioned relative to the overall plot
The newly added function
register_theme_elements()now allows developers
of extension packages to define their own new theme elements and place them
into the ggplot2 element tree (@clauswilke, #2540).
Minor improvements and bug fixes
coord_trans()now draws second axes and accepts
expandarguments to bring it up to feature parity with
ytransarguments that were
deprecated in version 1.0.1 in favour of
were removed (@paleolimbot, #2990).
coord_trans()now calculates breaks using the expanded range
(previously these were calculated using the unexpanded range,
which resulted in differences between plots made with
and those made with
coord_cartesian()). The expansion for discrete axes
coord_trans()was also updated such that it behaves identically
to that in
expand_scale()was deprecated in favour of
more informative warnings when supplied with set aesthetics
and mapped aesthetics (i.e.,
ggplot2 no longer depends on reshape2, which means that it no longer
(recursively) needs plyr, stringr, or stringi packages.
valueswith the order of
valuesis an unnamed vector. Previously, unnamed
valueswould match with
the limits of the scale and ignore the order of any
that this may change the appearance of plots that previously relied on the
unordered behaviour (#2429, @idno0001).
The data mask pronoun,
.data, is now stripped from default labels.
Addition of partial themes to plots has been made more predictable;
stepwise addition of individual partial themes is now equivalent to
addition of multple theme elements at once (@clauswilke, #3039).
This is a patch release fixing a few regressions introduced in 3.2.0 as well as
fixing some unit tests that broke due to upstream changes.
position_stack()no longer changes the order of the input data. Changes to
the internal behaviour of
geom_ribbon()made this reordering problematic
with ribbons that spanned
y = 0(#3471)
qplot()with a single positional aesthetic will no longer title the
non-specified scale as
- Fixes unit tests for sf graticule labels caused by chages to sf
This is a minor release with an emphasis on internal changes to make ggplot2
faster and more consistent. The few interface changes will only affect the
aesthetics of the plot in minor ways, and will only potentially break code of
extension developers if they have relied on internals that have been changed.
This release also sees the addition of Hiroaki Yutani (@yutannihilation) to the
core developer team.
With the release of R 3.6, ggplot2 now requires the R version to be at least 3.2,
as the tidyverse is committed to support 5 major versions of R.
Two patches (#2996 and #3050) fixed minor rendering problems. In most cases,
the visual changes are so subtle that they are difficult to see with the naked
eye. However, these changes are detected by the vdiffr package, and therefore
any package developers who use vdiffr to test for visual correctness of ggplot2
plots will have to regenerate all reference images.
In some cases, ggplot2 now produces a warning or an error for code that previously
produced plot output. In all these cases, the previous plot output was accidental,
and the plotting code uses the ggplot2 API in a way that would lead to undefined
behavior. Examples include a missing
annotations across multiple facets (#3305), and not using aesthetic mappings when
drawing ribbons with
This release includes a range of internal changes that speeds up plot
generation. None of the changes are user facing and will not break any code,
but in general ggplot2 should feel much faster. The changes includes, but are
not limited to:
Caching ascent and descent dimensions of text to avoid recalculating it for
Using a faster data.frame constructor as well as faster indexing into
Removing the plyr dependency, replacing plyr functions with faster
geom_rug()gains an "outside" option to allow for moving the rug tassels to
outside the plot area (@njtierney, #3085) and a
lengthoption to allow for
changing the length of the rug lines (@daniel-wells, #3109).
All geoms now take a
key_glyphparamter that allows users to customize
how legend keys are drawn (@clauswilke, #3145). In addition, a new key glyph
timeseriesis provided to draw nice legends for time series
Layers now have a new member function
setup_layer()which is called at the
very beginning of the plot building process and which has access to the
original input data and the plot object being built. This function allows the
creation of custom layers that autogenerate aesthetic mappings based on the
input data or that filter the input data in some form. For the time being, this
feature is not exported, but it has enabled the development of a new layer type,
layer_sf()(see next item). Other special-purpose layer types may be added
in the future (@clauswilke, #2872).
Continuous scale limits now accept functions which accept the default
limits and return adjusted limits. This makes it possible to write
a function that e.g. ensures the limits are always a multiple of 100,
regardless of the data (@econandrew, #2307).
Minor improvements and bug fixes
coord_sf()graticule lines are now drawn in the same thickness as panel grid
coord_cartesian(), and seting panel grid lines to
now also works in
(@clauswilke, #2991, #2525).
economicsdata has been regenerated. This leads to some changes in the
values of all columns (especially in
psavert), but more importantly, strips
the grouping attributes from
ggplot2 no longer attaches any external packages when using functions that
depend on packages that are suggested but not imported by ggplot2. The
affected functions include
stat_bin()will now error when the number of bins exceeds 1e6 to avoid
accidentally freezing the user session (@thomasp85).
New theme elements allowing different ticks lengths for each axis. For instance,
this can be used to have inwards ticks on the x-axis (
outwards ticks on the y-axis (
axis.ticks.length.y) (@pank, #2935).
This is a minor release and breaking changes have been kept to a minimum. End users of ggplot2 are unlikely to encounter any issues. However, there are a few items that developers of ggplot2 extensions should be aware of. For additional details, see also the discussion accompanying issue #2890.
In non-user-facing internal code (specifically in the
aes()function and in
aestheticsargument of scale functions), ggplot2 now always uses the British
spelling for aesthetics containing the word "colour". When users specify a "color"
aesthetic it is automatically renamed to "colour". This renaming is also applied
to non-standard aesthetics that contain the word "color". For example, "point_color"
is renamed to "point_colour". This convention makes it easier to support both
British and American spelling for novel, non-standard aesthetics, but it may require
some adjustment for packages that have previously introduced non-standard color
aesthetics using American spelling. A new function
provided in case extension writers need to perform this renaming in their own code
Functions that generate other functions (closures) now force the arguments that are
used from the generated functions, to avoid hard-to-catch errors. This may affect
some users of manual scales (such as
etc.) who depend on incorrect behavior (@krlmlr, #2807).
Coordobjects now have a function
backtransform_range()that returns the
panel range in data coordinates. This change may affect developers of custom coords,
who now should implement this function. It may also affect developers of custom
geoms that use the
range()function. In some applications,
may be more appropriate (@clauswilke, #2821).
coord_sf()has much improved customization of axis tick labels. Labels can now
be set manually, and there are two new parameters,
label_axes, that can be used to specify which graticules to label on which side
of the plot (@clauswilke, #2846, #2857, #2881).
Two new geoms
geom_sf_text()can draw labels and text
on sf objects. Under the hood, a new
x and y coordinates from the coordinates of the sf geometries. You can customize
the calculation method via
fun.geometryargument (@yutannihilation, #2761).
Minor improvements and fixes
For faceted plots, data is no longer internally reordered. This makes it
safer to feed data columns into
aes()or into parameters of geoms or
stats. However, doing so remains discouraged (@clauswilke, #2694).
geom_text(..., parse = TRUE)now correctly renders the expected number of
items instead of silently dropping items that are empty expressions, e.g.
the empty string "". If an expression spans multiple lines, we take just
the first line and drop the rest. This same issue is also fixed for
geom_label()and the axis labels for
scale_*_datetime()can now display
a secondary axis that is a one-to-one transformation of the primary axis,
implemented using the
sec.axisargument to the scale constructor
now calculate normalized statistics including
stat_density()now includes the calculated statistic
nlevel, an alias for
scaled, to better match the syntax of