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
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
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.
The text was updated successfully, but these errors were encountered:
Reprex:
That seems to be happening here:
https://github.com/ropensci/plotly/blob/ebb017a6fbd1a582787017f98e8e40cb4f1431b3/R/ggplotly.R#L817
xlab("")
works, so the issue is definitely thatnchar
of a theme element that is set toelement_blank()
isNULL
. The same check happens a few lines later:https://github.com/ropensci/plotly/blob/ebb017a6fbd1a582787017f98e8e40cb4f1431b3/R/ggplotly.R#L839
I get the same error when setting
ylab
andggtitle
toelement_blank
, but not for setting the legend title to blank viatheme(legend.title = element_blank())
.I might be able to do a pretty minimal PR for this. The tests look reasonably straightforward.
The text was updated successfully, but these errors were encountered: