Graphical Timetables for BART

I have long been a devotee of visual displays of information, and E. R. Tufte has been one of my heroes. He has published a series of books on visual representations and presentations of data, with an emphasis on getting the information across rather than prettyfying it with useless graphical distractions like you see in USA Today and similar magazines.

One of the techniques presented in the first book ("The Visual Display of Quantitative Information") is the railway timetable first published by E. J. Marey in 1885. In one simple graphic it presents an amazing amount of information.

Well, I live in San Francisco, and the local metro railway (BART) just [Feb. '99] released a new schedule. As I picked up the printed sheets of masses of numbers I thought about how useless it was. To wit: when travelling in the city, BART only has one line; they branch out to their various destinations after leaving the city. The timetables are published on a per-line basis, which is fine if you wish to go to Pittsburg (a far-flung suburb) --- but for travel in the city, totally useless. I want to know when the next train is, which means I have to look through 4 of these sheets and figure it out.

I was looking around the BART information site on TransitInfo.Org (a superb site - check it out for any info on mass transit in the San Francisco area) and they happened to have all the BART schedules. How simple it would be write a little program to... Having a few moments to spare, I did just that. I downloaded the schedules, and wrote the program, and above you see the result.

Of course this image could be cleaned up a lot with just a little work, but I wanted to leave it as is to show off the program. It's written in about 500 lines in Icon, and is totally generic - the next time BART updates their schedules I just have to download the files and re-run the program. And of course it can be run on other schedules too.

A brief explanation: the different colours represent the several lines. Lines on BART are named for their destinations, hence the names Richmond, Dublin/Pleasanton, Fremont and Pittsburg/BayPoint. Each train is drawn in the colour representing the line. The differences in slope are due to the stations not all being the same distance apart (Marey's diagram puts stations a proportional distance apart so the slope of a line represents the speed of the train). Since BART trains all run at the same speed, and I wanted to keep special information out of the program, I decided to stick with non-proportionally spaced station markers.

Also, since I rarely go to the outlying areas, only the stations in the vicinity of San Francisco are plotted on the picture. (This is coincidental: when the program is run with many schedules, it only displays the stations common to all of them.)

The display above was created by running
   marey -rows 4 *.sch
The program also acccepts options to restrict the time period displayed.
   marey -rows 3 -from 8:00am -to 9:00pm fremont*.sch richmond*.sch
A file may be used to map the system acronyms with human-readable names.
   marey -m bartmap -rows 4 -size 1200x800 *.sch

If you want to experiment with the program, the source (including some schedules and a station name map) is in; if you want to learn more about Icon, send me email. I use Icon for everything from cute little graphical things like this (and this) and for sysadmin kinds of things. Icon is a sane and sensible alternative to Perl, is totally free, and runs on Unix, Windows, Amigas, Ataris, Macs, ...


  1. The Visual Display of Quantitative Information. Edward R. Tufte, Graphics Press, 1983; p. 31. ISBN 0 9613921 0 X. A truly wonderful book; a must-have if you're even casually, slightly, faintly interested in graphics. His other two books ("Envisioning Information" and "Visual Explanations") are also excellent, but VDQI will always remain my favourite.
  2. Also, The Collected Works of John Tukey. Tukey is a statistician, and among his tremendous corpus of work are some wonderful techniques for visualising large collections of numerical data.
  3. Trainspotter? Here's a site on San Francisco rail transit systems — BART, Muni, etc.

Links to

Shamim Mohamed
Send me mail
$Date: 2005/07/23 20:37:43 $