-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
I used to do this to remove axis labels
ggplot(mtcars, aes(cyl, mpg)) + geom_point() + labs(x = element_blank())
With the new ggplot2, I get the new warning.
#> `label` cannot be a <ggplot2::element_blank> object.
The warning isn't that helpful. Took me a while to figure it out in a big plot construction.
Turns out I just have to use labs(x = NULL)
instead.
I will change that everywhere in my code. But the problem comes when I use ggplotly()
.
ggplotly(ggplot(mtcars, aes(cyl, mpg)) + geom_point() + labs(x = element_blank()))
#> Erreur in as.vector(x, "character") :
#> cannot coerce type 'object' to vector of type 'character'
I wonder if that's an issue that should be fixed in ggplot2 (better warning), plotly (work with this), or my code. Possibly all 3, but I guess we can wait for more reports before taking action. I will update my code to get rid of element_blank()
in the labs()
calls.
Research notes
Changes occured in #6364
jan-glx
Metadata
Metadata
Assignees
Labels
No labels