Mort's graphing code