March 8, 2017

Developing Data Products - Plotly Assignment

  • ploty plot example.

  • Using MTCARS Dataset

  • The dataset includes fuel consumption and automobile design and performance for 32 automobiles (1973-74 models).

  • PLotting "Weight(1000 lbs) vs Miles Per Gallon"

Code for Plot

f <- list(family = "Courier New, monospace",
          size = 18,
          color = "#7f7f7f")

x <- list(title = "Miles Per Gallon",titlefont = f)

y <- list(title = "Weight (1000 lbs)",titlefont = f)

p <- plot_ly(mtcars, x = ~mpg, y = ~wt,
             color = ~mpg,size = ~mpg,
             text = ~paste("Horse Power: ", hp)) %>%
             layout(xaxis = x, yaxis = y)
p

Weight(1000 lbs) vs Miles Per Gallon

Thank you!