Skip to content
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ggplot2 (development version)

* `scale_*_manual()` no longer displays extra legend keys, or changes their
order, when a named `values` argument has more items than the data. The
previous behaviour can be replicated by using
`scale_*_manual(values = vals, limits = names(vals))`. (@teunbrand, @banfai,
#4511, #4534, #4556, #4545, #4616)
Comment thread
teunbrand marked this conversation as resolved.
Outdated

# 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
Expand Down
4 changes: 2 additions & 2 deletions R/scale-manual.r
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ manual_scale <- function(aesthetic, values = NULL, breaks = waiver(), ..., limit
force(values)
}

if (is.null(limits)) {
limits <- names(values)
if (is.null(limits) && !is.null(names(values))) {
limits <- function(x) {intersect(x, names(values))}
Comment thread
teunbrand marked this conversation as resolved.
Outdated
}

# order values according to breaks
Expand Down