Factored out some common graphing code.

Some minor code consolidation.