Open talgalili opened 6 years ago
This issue could probably be renamed to a more general "ggplotly ignores na.value colour" as it applies also to other functions, like scale_fill_continuous()
or scale_fill_gradient()
.
Here is a minimal reproducible example:
library(ggplot2)
library(plotly)
# default NA colour is "grey50"
(default_na_colour <- ggplot(mapping = aes(x = 1:2, y = 1:2, fill = c(1, NA))) +
geom_tile())
ggplotly(default_na_colour)
# replace default colour
(custom_na_colour <- ggplot(mapping = aes(x = 1:2, y = 1:2, fill = c(1, NA))) +
geom_tile() +
scale_fill_continuous(na.value = "red"))
ggplotly(custom_na_colour)
@stragu done.
@cpsievert fyi this is a more general issue, see @stragu 's comment.
Still a problem with 4.10.2.
Code to replicate the bug:
Output in ggplot2:
But this is how it looks in plotly:
This is the cause of https://github.com/talgalili/heatmaply/issues/122
I've used this in the latest cutting edge ggplot2 and plotly