-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
This bug was reported in https://stackoverflow.com/q/64873086/2554330 where the user couldn't get colours consistent across two graphs. Code here is basically what was posted there.
library(ggplot2)
library(gridExtra)
v <- list()
v[[1]] <- ggplot(faithfuld, aes(waiting, eruptions, z = density)) + stat_contour_filled(breaks=(0:10)*0.005)
v[[2]] <- ggplot(faithfuld, aes(waiting, eruptions, z = 1.1*density)) + stat_contour_filled(breaks=(0:10)*0.005)
do.call(grid.arrange, v)
Notice that neither graph lists all bins between the specified breaks, and they are inconsistent about assigning colours to corresponding bins, most obviously at the top end where the first graph leaves out 2 bins and the bottom graph leaves out one.
What I would expect is that if the breaks
are specified explicitly, the colour would depend on the specified bins, not just the non-empty ones.
Metadata
Metadata
Assignees
Labels
No labels