+ - 0:00:00
Notes for current slide
Notes for next slide

Calendar-based Graphics
for
Visualising People’s Daily Schedules

Earo Wang

Monash University

Dec 11, 2017

1 / 21

Melbourne pedestrian activity

2 / 21

Pedestrian counting system

- sensors

The city of Melbourne

3 / 21

Pedestrian counting system

- sensors

- the data

#> # A tibble: 378,024 x 6
#> Sensor Date_Time Date
#> <chr> <dttm> <date>
#> 1 Alfred Place 2017-01-01 2017-01-01
#> 2 Australia on Collins 2017-01-01 2017-01-01
#> 3 Birrarung Marr 2017-01-01 2017-01-01
#> 4 Bourke St-Russell St (West) 2017-01-01 2017-01-01
#> 5 Bourke Street Mall (North) 2017-01-01 2017-01-01
#> 6 Bourke Street Mall (South) 2017-01-01 2017-01-01
#> 7 Chinatown-Lt Bourke St (South) 2017-01-01 2017-01-01
#> 8 Chinatown-Swanston St (North) 2017-01-01 2017-01-01
#> 9 City Square 2017-01-01 2017-01-01
#> 10 Collins Place (North) 2017-01-01 2017-01-01
#> # ... with 378,014 more rows, and 3 more variables:
#> # Time <int>, Count <int>, Holiday <lgl>
4 / 21

Take a glimpse

- selected sensors

  • Southbank
  • Southern Cross Station
  • Victoria Market
5 / 21

Take a glimpse

- selected sensors

- time series plot

6 / 21

Take a glimpse

- selected sensors

- time series plot

- faceted display

7 / 21
8 / 21
9 / 21

calendar-based visualisation

10 / 21

Calendar-based vis

- construction

The grid position for any day in the month is given by

i=(gmod35)/7j=gmod7.

Let h and c be the scaled hour and count, respectively, then the final coordinates are given by:

x=j+hy=ic.

11 / 21

Calendar-based vis

- construction

- the args

The frame_calendar() function

frame_calendar(
data, x, y, date, calendar = "monthly", dir = "h",
sunday = FALSE, nrow = NULL, ncol = NULL, polar = FALSE,
scale = "fixed", width = 0.95, height = 0.95
)
  • x, y: a unquoted (or bare) variable mapping to x and y axis.
  • date: a Date variable mapping to dates in the calendar.
  • calendar: type of calendar. "monthly", "weekly", "daily".
  • sunday: FALSE indicating to starting with Monday in a week, or TRUE for Sunday.
  • nrow, ncol: number of rows and columns defined for "monthly" calendar layout.
  • scale: "fixed", "free", "free_wday", and "free_mday".
12 / 21

Calendar-based vis

- construction

- the args

- usage

Rearrange the data

sx_cal <- pedestrian %>%
filter(Sensor == "Southern Cross Station") %>%
frame_calendar(x = Time, y = Count, date = Date)
#> # A tibble: 8,232 x 5
#> Time Count Date .Time .Count
#> * <int> <int> <date> <dbl> <dbl>
#> 1 0 1335 2017-01-01 0.2583333 0.9860202
#> 2 1 463 2017-01-01 0.2598631 0.9721692
#> 3 2 219 2017-01-01 0.2613929 0.9682934
#> 4 3 122 2017-01-01 0.2629227 0.9667527
#> 5 4 21 2017-01-01 0.2644525 0.9651484
#> 6 5 28 2017-01-01 0.2659823 0.9652596
#> 7 6 26 2017-01-01 0.2675121 0.9652278
#> 8 7 35 2017-01-01 0.2690419 0.9653708
#> 9 8 55 2017-01-01 0.2705717 0.9656884
#> 10 9 82 2017-01-01 0.2721014 0.9661173
#> # ... with 8,222 more rows
13 / 21

Calendar-based vis

- construction

- the args

- usage

Initialise the plot with ggplot2

p1_sx <- sx_cal %>%
ggplot(aes(x = .Time, y = .Count, group = Date)) +
geom_line()

14 / 21

Calendar-based vis

- construction

- the args

- usage

Add reference lines and labels

prettify(p1_sx)

15 / 21

Calendar-based vis

- construction

- the args

- usage

Colour mapping as usual

p2_sx <- sx_cal %>%
ggplot(aes(x = .Time, y = .Count, colour = Holiday, group = Date)) +
geom_line()
prettify(p2_sx)

16 / 21

Calendar-based vis

- construction

- the args

- usage

Zoom in to March

17 / 21

Calendar-based vis

- construction

- the args

- usage

Naturally work with the group_by()

facet_cal <- subdat %>%
group_by(Sensor) %>%
frame_calendar(
x = Time, y = Count, date = Date, nrow = 2
)
p_facet <- facet_cal %>%
ggplot(aes(x = .Time, y = .Count, group = Date)) +
geom_line(aes(colour = Sensor)) +
facet_grid(Sensor ~ .) +
scale_colour_brewer(palette = "Dark2")
prettify(p_facet, label = NULL)
18 / 21

Calendar-based vis

- construction

- the args

- usage

Faceted calendar plots

19 / 21

Summary

  • The full range of plotting capabilities in ggplot2 is essentially available, from geom_point() to geom_boxplot().
  • Other language supports are made for month and weekday labels, like CJK.
  • Patterns on special events for the region, like Anzac Day in Australia, or Thanksgiving Day in the USA, more easily pop out to the viewer as public holidays.
  • This sort of layout will be useful for studying consumer trends, or human behavior, such as pedestrian patterns or residential electricity demand.
20 / 21

Joint work with Di Cook and Rob J Hyndman

Made with and

Questions

21 / 21

Melbourne pedestrian activity

2 / 21
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow