# Task 1: Reflection
This exercise involves developing interactive plots and dashboards
based on the mtcars dataset. I had a good feeling regarding
how to perform interactive visualizations using ggplot2 and
plotly. Later, I did a simple dashboard with
{flexdashboard}; that allowed me to organize multiple plots
in a visually structured way. It was interesting to understand how to
publish the Dashboard in RPubs and at which point R can be used to
produce sharable and interactive reports.
options(repos = c(CRAN = "https://cloud.r-project.org"))
library(tidyverse)
library(plotly)
# Load data here
cars <- read_csv("data/mtcars.csv")
Do the following:
geom_point()).plotting <- ggplot(cars, aes(x = wt, y = mpg, color = factor(cyl), text = model)) +
geom_point(size = 2) + labs (
title = "MPG vs Weight",
x = "Weight",
y = "Miles Per Gallon",
color = "Cylinders"
)
ggplotly().Adding tooltip to our interactive plot with ggplotly to enhance User Interface with information pop up by hovering our each data plots. Hovering contains a sequenced information of wt, mpg, factor, and the car model name for each data plot. Red dots showcases the models with highest MPG and least weight while green is mid and blue is problematic zone. We see that Toyota Corolla was the most effiecient vehicle while on the other hand Lincoln Continental was opposite
interactive_plot <- ggplotly(plotting, tooltip = c("text", "x", "y", "color"))
interactive_plot