use StringIO instead of temp file for IPython rich display of graphs