Get startedGet started for free

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.

This exercise is part of the course

Visualizing Big Data with Trelliscope in R

View Course

Exercise 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

library(trelliscopejs)
library(ggplot2)

# Create the plot
ggplot(___) +
  ___ +
  facet_trelliscope(~ ___ + ___, ___) +
  theme(___)
Edit and Run Code