Feb 282010
I have been working on some offline processing of data and creating graphs on the fly which automatically get updated on a website. What has been problematic is to do this without a display (for example run from a cron job). I found a solution which seems to work with the EPD package I am using on a linux box.
1 2 3 4 5 6 7 | from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg fig = Figure(figsize=(4,4)) fig.gca().plot(range(1,10)) canvas=FigureCanvasAgg(fig) canvas.print_figure('bob.png', dpi=150) |
There are likely some other ways to do it, but this works for me.



Recent Comments