Description Usage Arguments Examples
Send a ggplot to plot.ly.
1 | ggplotly(gg, p)
|
gg |
a ggplot. |
p |
a plotly interface object. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | if(interactive()){
if(!"p" %in% ls()){
stop("first create a plotly interface object p:\np <- plotly::plotly(username, key)")
}
ggiris <- qplot(Petal.Width, Sepal.Length, data=iris, color=Species)
ggplotly(ggiris, p)
data(canada.cities, package="maps")
viz <- ggplot(canada.cities, aes(long, lat))+
borders(regions="canada", name="borders")+
coord_equal()+
geom_point(aes(text=name, size=pop), colour="red",
alpha=1/2, name="cities")
ggplotly(viz, p)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.