November 7, 2018

Building Code for Plotly Plots

data("ToothGrowth")
p1<-ggplot(ToothGrowth, 
           aes(x= supp, y=len, color=as.factor(dose)),
           geom = "dotplot") + 
      geom_point() + 
      ggtitle("Supplement vs. Tooth Growth")
p2<-ggplot(ToothGrowth, 
           aes(x= as.factor(dose), y=len, color=supp),
           geom = "dotplot") + 
      geom_point() + 
      ggtitle("Supplement Dosage vs. Tooth Growth")

Supplement vs. Tooth Growth

ggplotly(p=p1)

Doseage vs. Tooth Growth

ggplotly(p=p2)