simplified graphing code