I don't think this is just an issue of "bbox_inches" option. For
example, if you create an axes of rect=[0,0,1,1] and save the figure
(w/o bbox_inches option), you will see a similar behavior.
Also, I believe that the result depends on the backends.
I think this kind of issue is quite difficult to resolve and I doubt
if this will be solved anytime soon.
Any contribution will be very much appreciated.
I think this clipping issue is caused by a figure size that's one pixel larger than the actual canvas. Here's the example that Jae-Joon suggested:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(8, 6), dpi=100)
plt.axes([0, 0, 1, 1])
print fig.transFigure.transform((0, 0))
print fig.transFigure.transform((1, 1))
The saved figure is 800x600 pixels, and the right and bottom edge are clipped. Also, notice that the figure coordinate (0, 0) gets transformed to (0, 0) in pixel space (display space?), while the figure coordinate (1, 1) gets transformed to (800, 600) in pixel space. But, a figure that includes a point at (0, 0) and (800, 600) would have to be at least 801x601 in size.
The strange part is that the origin of the figure space is the bottom-left, but the image gets clipped at the bottom and right edges. I would have expected the bottom-and-left edges *or* the top-and-right edges to be clipped.
On Jul 30, 2010, at 8:04 PM, Jae-Joon Lee wrote:
On Sat, Jul 31, 2010 at 5:48 AM, Damon McDougall > <D.McDougall@...230...> wrote:
Aha! Even without the text, i.e. setting label1On = False for all the major ticks, the behaviour I see is that with bbox_inches = 'tight' and pad_inches = 0.0 I get the saved figure which includes the black border line for the bottom and left edges, but not the top and right edges. This may have something to do with it. Maybe it's an issue with the bounding box not being 'inclusive' and leaving out the end points?
University of Warwick
On 30 Jul 2010, at 20:33, Eric Firing wrote:
On 07/30/2010 06:32 AM, Damon McDougall wrote:
Hmm, it seems as though tick labels get clipped on the top and on the right when passing bbox_inches='tight' and pad_inches=0.0. I wouldn't expect this behaviour. Is there perhaps a bug in Bbox.union that's causing this?
Not likely. Much more likely is a problem in calculating the rendered
size of the text.
University of Warwick