r - Error in ggplotly: attempt to apply non-function -


i produce interactive ggplot graph using function ggplotly

here code:

set.seed(100) d <- diamonds[sample(nrow(diamonds),1000),]  p <- ggplot(data = d,aes(x=carat,y=price))+   geom_point(aes(text=paste("clarity:",clarity)),size = 4)+   geom_smooth(aes(color = cut,fill=cut))+facet_wrap(~cut)  gg <- ggplotly(p) 

however, error shows after last codeggplotly(p):

error in gg2list(p, width = width, height = height, tooltip = tooltip, : attempt apply non-function

any idea fix problem?

use plotly_build instead. following code works on pc:

set.seed(100) d <- diamonds[sample(nrow(diamonds),1000),]  p <- ggplot(data = d,aes(x=carat,y=price))+   geom_point(aes(text=paste("clarity:",clarity)),size = 4)+   geom_smooth(aes(color = cut,fill=cut))+facet_wrap(~cut)   gg <- plotly_build(p) print(gg) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -