On Tue, 8 Mar 2011 02:03:54 +0900
Jae-Joon Lee <lee.j.j...@gmail.com> wrote:

> On Mon, Mar 7, 2011 at 7:36 PM, Yuri D'Elia <wav...@users.sf.net> wrote:
> In fact, supporting the "bbox_inches" is a real hack.
> As I mentioned in my previous email, matplotlib artists can have
> spline paths. And artists can also be clipped by an arbitrary spline
> path. And, generally speaking, finding out the exact bounding box of
> an artist is difficult (but I must confess that I'm not an expert on
> this field and any correction or advise will be appreciated). I
> believe the AGG library, that matplotlib is based on, can provide an
> approximate bounding box for spline paths, but I'm not sure if it will
> work when clipping is involved (at least, the  *get_window_extent*
> does not properly work when clipping is involved).

I see. But can't you simply skip spline paths from the calculation?
This would remove the need for bbox_extra_artists for 99% of the cases.

> I'll consider to support all artists in a "tight" bbox mode if
> *get_window_extent* gives back exact bounding box (accounting the
> clipping) for "all" artists. Otherwise, I'm not inclined to do this.

I don't know if you read this already, but: all artists should at least work 
with bbox_extra_artists, right?

While placing the legend outside the plot I tried the following:

egend = plot.legend()
pic.savefig(..., bbox_extra_artists=[legend])

but it fails:

Traceback (most recent call last):
  File "./plot.py", line 108, in <module>
    fig.savefig(sys.argv[1], bbox_inches='tight', bbox_extra_artists=xa)
  File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1084, in 
savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1894, 
in print_figure
    in kwargs.pop("bbox_extra_artists", [])]
TypeError: get_window_extent() takes exactly 1 argument (2 given)


------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to