Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ggplot2 (development version)

* Manual scales now allow named vectors passed to `values` to contain fewer
elements than existing in the data. Elements not present in values will be set
to `NA` (@thomasp85, #3451)

* Add support for the BrailleR package for creating descriptions of the plot
when rendered (@thomasp85, #4459)

Expand Down
2 changes: 1 addition & 1 deletion R/scale-manual.r
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ manual_scale <- function(aesthetic, values = NULL, breaks = waiver(), ...) {
}

pal <- function(n) {
if (n > length(values)) {
if (is.null(names(values)) && n > length(values)) {
abort(glue("Insufficient values in manual scale. {n} needed but only {length(values)} provided."))
}
values
Expand Down