library(plotly)
library(dplyr)
data(Orange)
mod <- lm(Orange$circumference ~ Orange$age)
xax <- list(title = "Age of Tree", titlefont = list(family="Modern COmputer Roman"))
yax <- list(title = "Circumference of Tree", titlefont = list(family="Modern COmputer Roman"))
fig <- plot_ly(x = Orange$age, y = Orange$circumference, type = 'scatter', mode = 'markers', name = 'Circumference VS. Age') %>%
add_lines(x = Orange$age, y = fitted(mod), name = 'Linear Regression Line') %>%
layout(xaxis = xax, yaxis = yax, title = 'Tree Circumference VS. Age')
print(fig)