Instacart Data Plots
data("instacart")
Plot 1: Snack Purchases
yax_title = list(title = "Number of Purchases")
xax_title = list(title = "Types of Snacks")
snack_bar =
instacart %>%
filter(department == "snacks") %>%
count(aisle) %>%
mutate(
aisle = fct_reorder(aisle, n)
) %>%
plot_ly(x = ~aisle, y = ~n, color = ~aisle, colors = "viridis", type = "bar") %>%
layout(yaxis = yax_title, xaxis = xax_title)
snack_bar
Plot 3: Snack Orders by Time
y_title = list(title = "Number of Snack Orders")
x_title = list(title = "Hour of the Day (Military Time)")
snack_hour =
instacart %>%
filter(department == "snacks") %>%
group_by(order_hour_of_day) %>%
plot_ly(
x = ~order_hour_of_day,
colors = "viridis",
type = "histogram"
) %>%
layout(yaxis = y_title, xaxis = x_title)
snack_hour