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