简体   繁体   中英

ggplotly “what” error on help file examples

I am trying to make some interactive plots to help me explore my data. However when I try and turn a ggplot into a plotly I get the following error

Error in inherits(theme[[element]], ggplot_global$element_tree[[element]]$class) : 'what' must be a character vector

This error message appears even when running example code, for example the first example on the ggplotly help shown below.

ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species)
ggplotly(ggiris)

However if I use plotly directly then the no error message appears. The below works without issue.

allCities <- txhousing %>%
  group_by(city) %>%
  plot_ly(x = ~date, y = ~median) %>%
  add_lines(alpha = 0.2, name = "Texan Cities", hoverinfo = "none")

allCities %>%
  filter(city == "Houston") %>%
  add_lines(name = "Houston")  

I am using ggplotly 4.8.0 My session info is as follows.

R version 3.5.3 (2019-03-11) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.2 LTS

I was having the same error, when I restarted my R session and uploaded package::plotly only, it worked fine. I think the issue was due to a conflict with another package. It might have been package::ggtern for my case, i got this from the link below.

Why does ggplotly break when ggtern is loaded?

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM