Why does ggplotly break when ggtern is loaded?

回眸只為那壹抹淺笑 提交于 2019-12-11 19:44:59

问题


I was hoping to use plotly::ggplotly() to plot a graph produced with ggtern() with a tooltip feature. But loading the package ggtern caused ggplotly to throw the following error:

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

What's more, this error appears for all graphs, not just those produced by ggtern.

Here is an example.

library(ggplot2)

# This works
gg.mtcars <- ggplot(mtcars, aes(hp, mpg)) +
  geom_point()
plotly::ggplotly(gg.mtcars)

library(ggtern)

data("Feldspar")

gg.feldspar <- ggtern(data = Feldspar, aes(x = Ab, y = An, z = Or)) +
  geom_point()

# This throws an error
plotly::ggplotly(gg.feldspar)

# And now this throws an error too
plotly::ggplotly(gg.mtcars)

来源:https://stackoverflow.com/questions/56083771/why-does-ggplotly-break-when-ggtern-is-loaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!