NEWS.md

ggplot2 3.5.1

This is a small release focusing on fixing regressions from 3.5.0 and documentation updates.

Bug fixes

Improvements

ggplot2 3.5.0

This is a minor release that turned out quite beefy. It is focused on overhauling the guide system: the system responsible for displaying information from scales in the guise of axes and legends. As part of that overhaul, new guides have been implemented and existing guides have been refined. The look and feel of guides has been mostly preserved, but their internals and styling options have changed drastically.

Briefly summarising other highlights, we also welcome coord_radial() as a successor of coord_polar(). Initial support for newer graphical features, such as pattern fills has been added. The API has changed how I()/<AsIs> vectors interact with the scale system, namely: not at all.

Breaking changes

New features

The guide system

The guide system encompassing axes and legends, as the last remaining chunk of ggplot2, has been rewritten to use the <ggproto> system instead of the S3 system. This change was a necessary step to officially break open the guide system for extension package developers. The axes and legends now inherit from a <Guide> class, which makes them extensible in the same manner as geoms, stats, facets and coords (#3329, @teunbrand)

Axes

Legends

Improvements

Bug fixes

Internal changes

ggplot2 3.4.4

This hotfix release adapts to a change in r-devel's base::is.atomic() and the upcoming retirement of maptools.

ggplot2 3.4.3

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

ggplot2 3.4.2

This is a hotfix release anticipating changes in r-devel, but folds in upkeep changes and a few bug fixes as well.

Minor improvements

Bug fixes

ggplot2 3.4.1

This is a small release focusing on fixing regressions in the 3.4.0 release and minor polishes.

Breaking changes

New features

Bug fixes

In binned scales:

ggplot2 3.4.0

This is a minor release focusing on tightening up the internals and ironing out some inconsistencies in the API. The biggest change is the addition of the linewidth aesthetic that takes of sizing the width of any line from size. This change, while attempting to be as non-breaking as possible, has the potential to change the look of some of your plots.

Other notable changes is a complete redo of the error and warning messaging in ggplot2 using the cli package. Messaging is now better contextualised and it should be easier to identify which layer an error is coming from. Last, we have now made the switch to using the vctrs package internally which means that support for vctrs classes as variables should improve, along with some small gains in rendering speed.

Breaking changes

New features

Minor improvements and bug fixes

ggplot2 3.3.6

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.

ggplot2 3.3.5

This is a very small release focusing on fixing a couple of untenable issues that surfaced with the 3.3.4 release

ggplot2 3.3.4

This is a larger patch release fixing a huge number of bugs and introduces a small selection of feature refinements.

Features

Fixes

ggplot2 3.3.3

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.

ggplot2 3.3.2

This is a small release focusing on fixing regressions introduced in 3.3.1.

ggplot2 3.3.1

This is a small release with no code change. It removes all malicious links to a site that got hijacked from the readme and pkgdown site.

ggplot2 3.3.0

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.

Breaking changes

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 fail.

New features

Extensions

Minor improvements and bug fixes

ggplot2 3.2.1

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.

ggplot2 3.2.0

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.

Breaking changes

New features

Extensions

Minor improvements and bug fixes

ggplot2 3.1.0

Breaking changes

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.

New features

Minor improvements and fixes

ggplot2 3.0.0

Breaking changes

Tidy evaluation

The first two arguments of facet_grid() become rows and cols and now support vars() inputs. Note however that we took special care to ensure complete backward compatibility. With this change facet_grid(vars(cyl), vars(am, vs)) is equivalent to facet_grid(cyl ~ am + vs), and facet_grid(cols = vars(am, vs)) is equivalent to facet_grid(. ~ am + vs).

One nice aspect of the new interface is that you can now easily supply names: facet_grid(vars(Cylinder = cyl), labeller = label_both) will give nice label titles to the facets. Of course, those names can be unquoted with the usual tidy eval syntax.

sf

r nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) ggplot(nc) + geom_sf(aes(fill = AREA)) It supports all simple features, automatically aligns CRS across layers, sets up the correct aspect ratio, and draws a graticule.

New features

stat() is particularly nice for more complex calculations because you only need to specify it once: aes(y = stat(count / max(count))), rather than aes(y = ..count.. / max(..count..))

Layers: geoms, stats, and position adjustments

The padding parameter adds a small amount of padding between elements (@karawoo, #2143) and a reverse parameter allows you to reverse the order of placement (@karawoo, #2171).

Scales and guides

Separate expansion limits may be useful for bar charts, e.g. if one wants the bottom of the bars to be flush with the x axis but still leave some (automatically calculated amount of) space above them:

```r
ggplot(mtcars) +
    geom_bar(aes(x = factor(cyl))) +
    scale_y_continuous(expand = expand_scale(mult = c(0, .1)))
```

It can also be useful for line charts, e.g. for counts over time, where one wants to have a ’hard’ lower limit of y = 0 but leave the upper limit unspecified (and perhaps differing between panels), with some extra space above the highest point on the line (with symmetrical limits, the extra space above the highest point could in some cases cause the lower limit to be negative).

The old syntax for the expand argument will, of course, continue to work (@huftis, #1669).

Margins

Extension points

Minor bug fixes and improvements

Faceting

Scales

Layers

Coords

Themes

Guides

Other

ggplot2 2.2.1

ggplot2 2.2.0

Major new features

Subtitle and caption

Thanks to @hrbrmstr plots now have subtitles and captions, which can be set with the subtitle and caption arguments to ggtitle() and labs(). You can control their appearance with the theme settings plot.caption and plot.subtitle. The main plot title is now left-aligned to better work better with a subtitle. The caption is right-aligned (@hrbrmstr).

Stacking

position_stack() and position_fill() now sort the stacking order to match grouping order. This allows you to control the order through grouping, and ensures that the default legend matches the plot (#1552, #1593). If you want the opposite order (useful if you have horizontal bars and horizontal legend), you can request reverse stacking by using position = position_stack(reverse = TRUE) (#1837).

position_stack() and position_fill() now accepts negative values which will create stacks extending below the x-axis (#1691).

position_stack() and position_fill() gain a vjust argument which makes it easy to (e.g.) display labels in the middle of stacked bars (#1821).

Layers

geom_col() was added to complement geom_bar() (@hrbrmstr). It uses stat="identity" by default, making the y aesthetic mandatory. It does not support any other stat_() and does not provide fallback support for the binwidth parameter. Examples and references in other functions were updated to demonstrate geom_col() usage.

When creating a layer, ggplot2 will warn if you use an unknown aesthetic or an unknown parameter. Compared to the previous version, this is stricter for aesthetics (previously there was no message), and less strict for parameters (previously this threw an error) (#1585).

Facetting

The facet system, as well as the internal panel class, has been rewritten in ggproto. Facets are now extendable in the same manner as geoms and stats, as described in vignette("extending-ggplot2").

We have also added the following new features.

Extensions

Unfortunately there was a major oversight in the construction of ggproto which lead to extensions capturing the super object at package build time, instead of at package run time (#1826). This problem has been fixed, but requires re-installation of all extension packages.

Scales

Continuous scales

Date time

Discrete scales

The treatment of missing values by discrete scales has been thoroughly overhauled (#1584). The underlying principle is that we can naturally represent missing values on discrete variables (by treating just like another level), so by default we should.

This principle applies to:

And to all scales (both position and non-position.)

Compared to the previous version of ggplot2, there are three main changes:

  1. scale_x_discrete() and scale_y_discrete() always show discrete NA, regardless of their source

  2. If present, NAs are shown in discrete legends.

  3. All discrete scales gain a na.translate argument that allows you to control whether NAs are translated to something that can be visualised, or should be left as missing. Note that if you don't translate (i.e. na.translate = FALSE) the missing values will passed on to the layer, which will warning that it's dropping missing values. To suppress the warnings, you'll also need to add na.rm = TRUE to the layer call.

There were also a number of other smaller changes

Themes

There were a number of tweaks to the theme elements that control legends:

Bug fixes and minor improvements

ggplot2 2.1.0

New features

Bug fixes

ggplot2 2.0.0

Major changes

Extensibility

There is now an official mechanism for defining Stats, Geoms, and Positions in other packages. See vignette("extending-ggplot2") for details.

Text

Deprecated features

A number of geoms have been renamed to be internally consistent:

All defunct functions have been removed.

Default appearance

New and updated themes

Labelling

The facet labelling system was updated with many new features and a more flexible interface (@lionel-). It now works consistently across grid and wrap facets. The most important user visible changes are:

The labellers (such as label_value() or label_both()) also get some new features:

As a consequence of these changes, referring to x in backquoted expressions is deprecated.

On the programming side, the labeller API has been rewritten in order to offer more control when faceting over multiple factors (e.g. with formulae such as ~cyl + am). This also means that if you have written custom labellers, you will need to update them for this version of ggplot.

Documentation

Data

Bug fixes and minor improvements



Try the ggplot2 package in your browser

Any scripts or data that you put into this service are public.

ggplot2 documentation built on June 22, 2024, 11:35 a.m.