7/30/2019

Objective

Create a web page presentation using R Markdown that features a plot created with Plotly. Host your webpage on either github pages or Rpubs. Your webpage must contain the date that you created the document and it must contain a plot created with Plotly.

Slide with R code.

library(ggplot2)
library(plotly)

data("iris")

str(iris)
## 'data.frame':    150 obs. of  5 variables:
##  $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
##  $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
##  $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
##  $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
##  $ Species     : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...

Plot with Relation between Species and its Sepal length.

plot_ly(data = iris, y = ~Sepal.Length, color = ~Species, type = "scatter", mode = "lines")

Plot with Relation between Species and its Petal length.

plot_ly(data = iris, y = ~Petal.Length, color = ~Species, type = "scatter", mode = "lines")

Plot with Relation between Species and its Sepal width.

plot_ly(data = iris, y = ~Sepal.Width, color = ~Species, type = "scatter", mode = "lines")

Plot with Relation between Species and its Petal width.

plot_ly(data = iris, y = ~Petal.Width, color = ~Species, type = "scatter", mode = "lines")