Sunday, June 10

Some of my charting programs

From time to time I get asked how do I make my graphs.

Let me begin with my production line. I keep the data from many sources (including the ABS and the RBA) in a data-warehouse. I load the data into the warehouse using a series of programs I wrote in python. The warehouse itself is maintained in MySQL. I use the data language R with the ggplot2 package to make the graphs. I originally developed my graphs production line under Linux, but it now operates on my MacBook Pro under OSX Lion. I mention the environment, as I use Unix shell programs to link the steps in the production process together.

In the remainder of this post, I will focus on the last bit of the production line: the production of the graphs.

The first program I use, one of the first I wrote for this exercise some three or four years ago, is a file to connect to the MySQL data-warehouse. I call this program from every one of my charting programs. You will see an example further down below.



The next program I use holds my core plotting constants and routines. This program is long and tedious, but it allows me to chart new data very quickly. It also allows me to maintain a consistent look and feel across the various charts I produce. Most of the standard charts you can see on this site are produced somewhere in this program. As with the connection to the database, this program is called by almost all of my charting programs.



The program I wrote to produce the slides for this animation is an example of how I link these together ...



You will notice that it accesses a CSV file to select the series to chart. That CSV file is as follows. The Trend and Seasonally Adjusted items are the series identifiers used by the ABS. I use these same identifiers to keep the data items in the MySQL database.

No comments:

Post a Comment