Closed
Description
Reprex:
library(ggplot2)
library(plotly)
p <- ggplot(iris, aes(Petal.Length, Sepal.Width, color = Species)) +
geom_point() +
xlab(element_blank())
ggplotly(p)
#> Error in if (nchar(axisTitleText) > 0) {: argument is of length zero
That seems to be happening here:
xlab("")
works, so the issue is definitely that nchar
of a theme element that is set to element_blank()
is NULL
. The same check happens a few lines later:
I get the same error when setting ylab
and ggtitle
to element_blank
, but not for setting the legend title to blank via theme(legend.title = element_blank())
.
I might be able to do a pretty minimal PR for this. The tests look reasonably straightforward.
Metadata
Metadata
Assignees
Labels
No labels