Hi, I've searched the archives but can't find a solution to this problem. I'd like to remove the whitespace, padding, offset, etc on the left and right of the plot as I'm writing the entire thing to a jpg. I've turned the frame, axes, ticks off, but the space still remains.
I've attached the code and the resulting image. code (inside a django app): def hours_chart(request): from PIL import Image as PILImage from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure from matplotlib.axes import Axes from StringIO import StringIO fig = Figure(figsize=(3,1),facecolor='r') # w,h in inches fig.frameon = False canvas = FigureCanvas(fig) ax = fig.add_subplot(111) values = [d.get_total_hours() for d in Debrief.objects.all().order_by('date')] # the data ax.plot(values,lw=2) ax.axis('off') canvas.draw() size = canvas.get_renderer().get_canvas_width_height() buf=canvas.tostring_rgb() im=PILImage.fromstring('RGB', size, buf, 'raw', 'RGB', 0, 1) imdata=StringIO() im.save(imdata, format='JPEG') response = HttpResponse(imdata.getvalue(), mimetype='image/jpeg') return response This is the result -- as you can see there's a lot of white space on the left of the plot:
<<inline: chart.jpeg>>
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users