August 6, 2017

Week 3 Assignment

This presentation concerns the use of plot_ly within a R Markdown document. It presents a study of Orange dataset:

  • Tree. An ordered factor indicating the tree on which the measurement is made. The ordering is according to increasing maximum diameter.

  • age. A numeric vector giving the age of the tree (days since 1968-12-31)

  • circumference. A numeric vector of trunk circumferences (mm).

Code

library(plotly)
library(datasets)
p <- Orange %>%
      plot_ly(x = ~age, y = ~circumference, type = "scatter", 
              mode = "lines,markers", color = ~Tree)  %>%        
        layout(title = 'Orange Trees size vs Age',
                 xaxis=list(title = 'Age (Days since 1968-12-31)'),
                 yaxis=list(title = 'Circumference (mm)'))

Plot(ly)