ggplot2 breaking changes

cran

35 curated breaking changes across major versions of ggplot2. Use this as a migration checklist before bumping dependencies.

35
changes
Breaking changes by transition
  • v3.5.2 \u2192 v4.0.0breaking

    The S3 parts of ggplot2 have been replaced with S7 bits (#6352).

  • v3.5.2 \u2192 v4.0.0breaking

    (breaking) `geom_violin(quantiles)` now has actual quantiles based on the data, rather than inferred quantiles based on the computed density. The `quantiles` parameter that replaces `draw_quantiles` now belongs to `stat_ydensity()` instead of `geom_violin()` (@teunbrand, #4120).

  • v3.5.2 \u2192 v4.0.0breaking

    (Breaking) The defaults for all geoms can be set at one in the theme. (@teunbrand based on pioneering work by @dpseidel, #2239)

  • v3.5.2 \u2192 v4.0.0breaking

    A new `theme(geom)` argument is used to track these defaults.

  • v3.5.2 \u2192 v4.0.0breaking

    The `element_geom()` function can be used to populate that argument.

  • v3.4.4 \u2192 v3.5.0breaking

    The guide system. As a whole. See 'new features' for more information. While the S3 guide generics are still in place, the S3 methods for `guide_train()`, `guide_merge()`, `guide_geom()`, `guide_transform()`, `guide_gengrob()` have been superseded by the respective ggproto methods. In practice, this will mean that `NextMethod()` or sub-classing ggplot2's guides with the S3 system will no longer work.

  • v3.4.4 \u2192 v3.5.0breaking

    By default, `guide_legend()` now only draws a key glyph for a layer when the value is in the layer's data. To revert to the old behaviour, you can still set `show.legend = c({aesthetic} = TRUE)` (@teunbrand, #3648).

  • v3.4.4 \u2192 v3.5.0breaking

    In the `scale_{colour/fill}_gradient2()` and `scale_{colour/fill}_steps2()` functions, the `midpoint` argument is transformed by the scale transformation (#3198).

  • v3.4.4 \u2192 v3.5.0breaking

    The `legend.key` theme element is set to inherit from the `panel.background` theme element. The default themes no longer set the `legend.key` element. This causes a visual change with the default `theme_gray()` (#5549).

  • v3.4.4 \u2192 v3.5.0breaking

    The `scale_name` argument in `continuous_scale()`, `discrete_scale()` and `binned_scale()` is soft-deprecated. If you have implemented custom scales, be advised to double-check that unnamed arguments ends up where they should (@teunbrand, #1312).

  • v3.4.0 \u2192 v3.4.1breaking

    The computed variable `y` in `stat_ecdf()` has been superseded by `ecdf` to prevent incorrect scale transformations (@teunbrand, #5113 and #5112).

  • v3.3.6 \u2192 v3.4.0breaking

    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)

  • v3.3.6 \u2192 v3.4.0breaking

    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.

  • v3.3.6 \u2192 v3.4.0breaking

    The dot-dot notation (`..var..`) and `stat()`, which have been superseded by `after_stat()`, are now formally deprecated (@yutannihilation, #3693).

  • v3.3.6 \u2192 v3.4.0breaking

    `qplot()` is now formally deprecated (@yutannihilation, #3956).

  • v3.3.6 \u2192 v3.4.0breaking

    `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).

  • v3.2.1 \u2192 v3.3.0breaking

    The `panel_params` field in the `Layout` now contains a list of list of `ViewScale` objects, 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.

  • v3.2.1 \u2192 v3.3.0breaking

    `element_text()` now issues a warning when vectorized arguments are provided, as in `colour = c("red", "green", "blue")`. Such use is discouraged and not officially supported (@clauswilke, #3492).

  • v3.2.1 \u2192 v3.3.0breaking

    Changed `theme_grey()` setting for legend key so that it creates no border (`NA`) rather than drawing a white one. (@annennenne, #3180)

  • v3.2.1 \u2192 v3.3.0breaking

    `geom_ribbon()` now draws separate lines for the upper and lower intervals if `colour` is mapped. Similarly, `geom_area()` and `geom_density()` now draw the upper lines only in the same case by default. If you want old-style full stroking, use `outline.type = "full"` (@yutannihilation, #3503 / @thomasp85, #3708).

  • v3.1.1 \u2192 v3.2.0breaking

    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.

  • v3.1.1 \u2192 v3.2.0breaking

    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 `group` aesthetic in `geom_boxplot()` (#3316), annotations across multiple facets (#3305), and not using aesthetic mappings when drawing ribbons with `geom_ribbon()` (#3318).

  • v3.0.0 \u2192 v3.1.0breaking

    In non-user-facing internal code (specifically in the `aes()` function and in the `aesthetics` argument 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

  • v3.0.0 \u2192 v3.1.0breaking

    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 `scale_colour_manual()`, `scale_fill_manual()`, etc.) who depend on incorrect behavior (@krlmlr, #2807).

  • v3.0.0 \u2192 v3.1.0breaking

    `Coord` objects 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, `backtransform_range()` may be more appropriate (@clauswilke, #2821).

  • v2.2.1 \u2192 v3.0.0breaking

    ggplot2 now supports/uses tidy evaluation (as described below). This is a major change and breaks a number of packages; we made this breaking change because it is important to make ggplot2 more programmable, and to be more consistent with the rest of the tidyverse. The best general (and detailed) introduction to tidy evaluation can be found in the meta programming chapters in [Advanced R](https://adv-r.hadley.nz). The primary developer facing change is that `aes()` now contains quosures (express

  • v2.2.1 \u2192 v3.0.0breaking

    Error: Column `y` must be a 1d atomic vector or a list Internally, ggplot2 now uses `as.data.frame(tibble::as_tibble(x))` to convert a list into a data frame. This improves ggplot2's support for list-columns (needed for sf support), at a small cost: you can no longer use matrix-columns. Note that unlike tibble we still allow column vectors such as returned by `base::scale()` because of their widespread use.

  • v2.2.1 \u2192 v3.0.0breaking

    Error: More than one expression parsed Previously `aes_string(x = c("a", "b", "c"))` silently returned `aes(x = a)`. Now this is a clear error.

  • v2.2.1 \u2192 v3.0.0breaking

    Error: `data` must be uniquely named but has duplicate columns If layer data contains columns with identical names an error will be thrown. In earlier versions the first occuring column was chosen silently, potentially masking that the wrong data was chosen.

  • v2.2.1 \u2192 v3.0.0breaking

    Error: Aesthetics must be either length 1 or the same as the data Layers are stricter about the columns they will combine into a single data frame. Each aesthetic now must be either the same length as the data frame or a single value. This makes silent recycling errors much less likely.

  • v1.0.1 \u2192 v2.0.0breaking

    ggplot no longer throws an error if you your plot has no layers. Instead it automatically adds `geom_blank()` (#1246).

  • v1.0.1 \u2192 v2.0.0breaking

    New `cut_width()` is a convenient replacement for the verbose `plyr::round_any()`, with the additional benefit of offering finer control.

  • v1.0.1 \u2192 v2.0.0breaking

    New `geom_count()` is a convenient alias to `stat_sum()`. Use it when you have overlapping points on a scatterplot. `stat_sum()` now defaults to using counts instead of proportions.

  • v1.0.1 \u2192 v2.0.0breaking

    New `geom_curve()` adds curved lines, with a similar specification to `geom_segment()` (@veraanadi, #1088).

  • v1.0.1 \u2192 v2.0.0breaking

    Date and datetime scales now have `date_breaks`, `date_minor_breaks` and `date_labels` arguments so that you never need to use the long `scales::date_breaks()` or `scales::date_format()`.

API access

Get this data programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/breaking/cran/ggplot2
ggplot2 breaking changes — CRAN migration guide | DepScope