Does anyone know if this is expected to work?
library(ggplot2) df <- data.frame( x = 1:4, y = 1:4, colour = c("red", "green", "blue", "yellow") ) ggplot(df, aes(x, y)) + geom_tile(aes(fill = colour)) + scale_fill_identity( "trt", labels = letters[1:2], breaks = c("white", "black"), guide = "legend", drop = FALSE )
ggplot2 version: ggplot2_2.2.1
"Work" in this case would be a plot with a legend that has the specified labels with the symbols having the colors white and black. According to the documentation for scale_fill_identity and discrete_scale I would have expected the results to be similar to specifying drop = FALSE in scale_fill_manual (for example: https://stackoverflow.com/questions/37698773/ggplot2-legend-does-not-show-all-categories-even-with-drop-false/37700258).
I know it doesn't make a lot of sense to do so with the example but I have a use case where it does... Thanks in advance for any insight!