12/31/2019

Introduction

Objective: Create a web page presentation using R Markdown that features a plot created with Plotly. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a plot created with Plotly. We would love to see you show off your creativity!

My Presentation: I will be creating a 3D Scatterplot of the mtcars dataset using Plotly. The plot will show the weight of the car on the x-axis, horsepower on the y-axis, and miles per gallon on the z-axis. Each marker will be color coded by transmission.

R Code

suppressMessages(suppressWarnings(library(plotly)))
data(mtcars)

mtcars$am[which(mtcars$am == 0)] <- 'Automatic'
mtcars$am[which(mtcars$am == 1)] <- 'Manual'
mtcars$am <- as.factor(mtcars$am)

plot <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~mpg,
                color = ~am, colors = c('#00CED1', '#F99245')) %>%
  add_markers() %>%
  layout(scene = list(xaxis = list(title = "Weight"),
                      yaxis = list(title = "Horsepower"),
                      zaxis = list(title = "Miles Per Gallon")))

plot

Interactive Plot