Task 1: Reflection

I first created a basic interactive plot in the regular format. Next I installed the framework package and set the format which has three plots. I didn’t feel brave enough to mess with the format so I just used three types of graphs, those being scatter plot, bar plot, and line plot respectively.

Task 2: Interactive plots

library(tidyverse)
library(plotly)
library(ggplot2)

set.seed(123)
data <- data.frame(
  x = rnorm(20),
  y = rnorm(20),
  label = paste("Point", 1:20),
  category = sample(c("A", "B"), 20, replace = TRUE)
)

plot <- ggplot(data, aes(x, y, text = paste("Label: ", label, "<br>Category: ", category))) +
  geom_point(aes(color = category)) +
  labs(title = "Interactive Scatter Plot") +
  theme_minimal()

interactive_plot <- ggplotly(plot, tooltip = "text")

print(interactive_plot)

# Load data here

Do the following:

  1. Make a plot. Any kind of plot will do (though it might be easiest to work with geom_point()).

  2. Make the plot interactive with ggplotly().

  3. Make sure the hovering tooltip is more informative than the default.

Good luck and have fun!

Task 3:

Install the {flexdashboard} package and create a new R Markdown file in your project by going to File > New File… > R Markdown… > From Template > Flexdashboard.

Using the documentation for {flexdashboard} online, create a basic dashboard that shows a plot (static or interactive) in at least three chart areas. Play with the layout if you’re feeling brave.