简体   繁体   中英

Object “new_panel” not found ggplotly error

I'm trying to use ggplotly with the following session info:

R version 3.3.1 (2016-06-21)
Platform: x86_64-ubuntu14-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base  

other attached packages:
[1] plotly_3.6.0      ggplot2_2.2.0     mra_1.0           frb_3.12

I am able to use the plot_ly function like so with the correct graph being made, so the plotly package seems to be working:

ploty_ly(z = volcano, type = "surface")

But am having difficulty with the ggplotly function:

p<-ggplot(data = mtcars, aes(x = hp, y = cyl)) +
geom_smooth(method = lm, formula = y~x) +
geom_point()

The above creates the graph p which displays when called.

However, when I call z <- ggplotly(p) , I get the following error:

Error in get(x, envir = ns, inherits = FALSE) : 
object 'new_panel' not found

Any ideas why I am getting this error/how I can fix it?

Between ggplot2 v2.1 and v2.2, apparently the internal format was changed. Now ggplotly from plotly has to follow, which it does in its latest 4.x branch.

Therefore you should update to plotly4 which will work while plotly 3 doesn't.

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