CommencerCommencer gratuitement

Visualizing the data: Counts by hour-of-day

We can now create a Trelliscope display using ggplot2. We want to plot number of rides vs. hour of day, colored by workweek / weekend, and faceted by route using facet_trelliscope().

route_hod is available in your workspace, but it only contains the top 8 routes. We will view the result for all top routes in the final exercise.

Cet exercice fait partie du cours

Visualizing Big Data with Trelliscope in R

Afficher le cours

Instructions

  • Use points to plot start_hod on the x-axis and n on the y-axis and color the points by weekday. Specify size = 3 in your geom specification to help the points stand out more prominently on the plot.
  • Facet by start and end station name, and set initial layout to be 2 rows and 4 columns.
  • To use less space, remove the legend adding theme(legend.position = "none") to your ggplot2 specification.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

library(trelliscopejs)
library(ggplot2)

# Create the plot
ggplot(___) +
  ___ +
  facet_trelliscope(~ ___ + ___, ___) +
  theme(___)
Modifier et exécuter le code