I am using matplotlib in a django app and would like to directly return the rendered image. So far I can go plt.savefig(...), then return the location of the im
plt.savefig(...)
what about cStringIO?
import pylab import cStringIO pylab.plot([3,7,2,1]) output = cStringIO.StringIO() pylab.savefig('test.png', dpi=75) pylab.savefig(output, dpi=75) print output.getvalue() == open('test.png', 'rb').read() # True