Ggplotly and Plotly’s R API let you make ggplots, add py$ggplotly(), and get an interactive, shareable, online plot.
install.packages("devtools")
library(devtools)
install_github("plotly", "ropensci")
library(plotly) # install necessary packages
## Loading required package: RCurl
## Loading required package: bitops
## Loading required package: RJSONIO
## Loading required package: ggplot2
library(ggplot2)
sign up (https://plot.ly/ssu) and use your account or our test account to make graph object
py <- plotly("RgraphingAPI", "ektgzomjbx") # sign up (https://plot.ly/ssu) and use your account or our test account to make graph object
Now we’ll embed a plot.
url<-"https://plot.ly/~etpinard/251"
plotly_iframe <- paste("<center><iframe scrolling='no' seamless='seamless' src='", url,
"/650/800' width='650' height='800'></iframe></center>", sep = "")