You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
geom_tile with only one possible value is grey #907
There seems to be a problem when a fill value in geom_tile only has one possible value.
Example below. You get grey instead of the color ggplot2 uses. This is an issue when you facet a geom_tile and one facet only contains one possible value. Then you get a completely grey tile instead of what color the value should have.
I'm guessing this has to do with scaling? Since you get NaN if you scale only identical values.
pp <- function (n,r=4) {
x <- seq(-r*pi, r*pi, len=n)
df <- expand.grid(x=x, y=x)
df$r <- sqrt(df$x^2 + df$y^2)
# df$z <- 1
df$z <- c(1,2)
df
}
p <- ggplot(pp(20), aes(x=x,y=y))
p <- p + geom_tile(aes(fill=z))
p
ggplotly(p)
ggplot:
plotly:
pp <- function (n,r=4) {
x <- seq(-r*pi, r*pi, len=n)
df <- expand.grid(x=x, y=x)
df$r <- sqrt(df$x^2 + df$y^2)
df$z <- 1
# df$z <- c(1,2)
df
}
p <- ggplot(pp(20), aes(x=x,y=y))
p <- p + geom_tile(aes(fill=z))
p
ggplotly(p)
Activity