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
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.
Honestly, I don't think this is a bug. Discrete scales drop empty factor levels by default, and you can set drop = FALSE to prevent this from happening. So your workaround is in fact the correct solution to this problem.
I think it's a workaround, not a solution, unless there's a way to specify drop = FALSE without saying anything else about the fill scale. It doesn't make sense for a user to need to know the current colour scheme just to avoid dropping ranges in the contour plot.
It doesn't make sense for a user to need to know the current colour scheme just to avoid dropping ranges in the contour plot.
I agree with this statement, but it's a more general problem than the one encountered here. You also encounter it when you want to, for example, change the labels that go with certain breaks in a scale. You can only do that by explicitly calling a scale function, and to do that you need to know which scale function to call.
This has been bugging me for a while, and I'd like to fix it in a general way, but it's non-trivial.
Activity
dmurdoch commentedon Nov 17, 2020
A workaround for this is to specify a scale with
drop = FALSE, e.g.So I suppose a fix would be to default to
drop = FALSEingeom_contour_filled.clauswilke commentedon Nov 17, 2020
Honestly, I don't think this is a bug. Discrete scales drop empty factor levels by default, and you can set
drop = FALSEto prevent this from happening. So your workaround is in fact the correct solution to this problem.dmurdoch commentedon Nov 17, 2020
I think it's a workaround, not a solution, unless there's a way to specify
drop = FALSEwithout saying anything else about the fill scale. It doesn't make sense for a user to need to know the current colour scheme just to avoid dropping ranges in the contour plot.clauswilke commentedon Nov 17, 2020
I agree with this statement, but it's a more general problem than the one encountered here. You also encounter it when you want to, for example, change the labels that go with certain breaks in a scale. You can only do that by explicitly calling a scale function, and to do that you need to know which scale function to call.
This has been bugging me for a while, and I'd like to fix it in a general way, but it's non-trivial.
clauswilke commentedon Nov 17, 2020
See e.g. here: #3973 (comment)
clauswilke commentedon Nov 17, 2020
I'm closing this in favor of #4269, which describes the general problem.