savefig bbox_inches='tight' does not consider suptitle

> Ok, I can understand that, but shouldn't all artists used to construct the picture, as suptitle, be considered?

I think considering all the artists is not very practical (as some of
them could have spline paths), but what we may be able to do is to
consider all the texts in the figure. I'll try to implement them.

Can you describe a scenario where considering all artists may produce wrong/unintended results?

Considering all texts in the figure might be a good-enough solution, but I honestly have an hard time figuring out a case where bbox_inches should ignore some elements.

I come from a gnuplot/asymptote background, so my view could be biased.

> import matplotlib as mpl
> import matplotlib.figure
> import matplotlib.backends.backend_agg
>
> fig = mpl.figure.Figure()
> cvs = mpl.backends.backend_agg.FigureCanvasAgg(fig)
> fig.set_size_inches((20,20))
> plot = fig.add_subplot(111)
> plot.set_title("Subtitle")
> plot.plot([1,2,3], [3,2,1])
> st = fig.suptitle("Horray!", fontsize=20)
> fig.savefig("out.png", bbox_inches='tight', bbox_extra_artists=[st])
>

I believe you're using a matplotlib version that the
"bbox_extra_artists" keyword was not yet implemented.
Can you try to install 1.0 version of matpltolib?
As Benjamin has confirmed, this is supposed to work (with recent
version of matplotlib).
If upgrading is not possible, I'll try to come up with a workaround (I
don't think it will be done with a few lines of code though).

Yes, thanks. By upgrading to 1.0, bbox_extra_artists now works.

ยทยทยท

On Sun, 6 Mar 2011 21:47:04 +0900 Jae-Joon Lee <lee.j.joon@...287...> wrote: