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
This is a bit of a weird corner case I think, but I've found (on CRAN and on the github version as of today) that setting size = NA on several geoms causes guide generation to fail and therefore the plot to fail to generate.
I'll use this data:
df=data.frame(
x= c(1, 2),
group= c("a","b")
)
First, a reprex with geom_tile() (the fill mapping is needed so that a guide is generated):
I would expect behavior more like setting color = NA; i.e. geoms (or outlines of geoms) would not be drawn but the plot would still generate. I've tracked this down to somewhere in the guide generation code. If you turn the legend off, you get a plot:
Here the warning is expected, but I think the error is not --- I would have expected output like what happens if you set color = NA; i.e. a blank plot:
As when size = NA this will result in key_size_mat being all NAs, and then key widths and heights downstream end up all NAs. However I don't know enough about the surrounding code/context to suggest an appropriate solution.
Thanks!
The text was updated successfully, but these errors were encountered:
This is a bit of a weird corner case I think, but I've found (on CRAN and on the github version as of today) that setting
size = NA
on several geoms causes guide generation to fail and therefore the plot to fail to generate.I'll use this data:
First, a reprex with
geom_tile()
(thefill
mapping is needed so that a guide is generated):Created on 2021-07-20 by the reprex package (v2.0.0)
I would expect behavior more like setting
color = NA
; i.e. geoms (or outlines of geoms) would not be drawn but the plot would still generate. I've tracked this down to somewhere in the guide generation code. If you turn the legend off, you get a plot:Which is what I would expect. Similar problems occur in other geoms; e.g.
geom_point()
:Here the warning is expected, but I think the error is not --- I would have expected output like what happens if you set
color = NA
; i.e. a blank plot:I believe the problem may be related to this line:
ggplot2/R/guide-legend.r
Line 385 in 13c0730
As when
size = NA
this will result inkey_size_mat
being allNA
s, and then key widths and heights downstream end up allNA
s. However I don't know enough about the surrounding code/context to suggest an appropriate solution.Thanks!
The text was updated successfully, but these errors were encountered: