ggplotly: Send a ggplot to plot.ly.

Description Usage Arguments Examples

Description

Send a ggplot to plot.ly.

Usage

1
ggplotly(gg, p)

Arguments

gg

a ggplot.

p

a plotly interface object.

Examples

 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)
}

tdhock/ggplotly documentation built on May 31, 2019, 7:36 a.m.