The svn version has a new keyword "bbox_extra_artists", which could be used.
But, there is no easy way for the released version of matplotlib.


Below is a workaround you may use, but it's a bit complicated.

Regards,

-JJ

fig = figure(1)
ax = fig.add_subplot(111)
l1, = ax.plot([1,2,3])
leg = figlegend([l1], ["test"], 1)


def get_tightbbox(renderer):
    from matplotlib.transforms import Bbox, TransformedBbox, Affine2D

    bb = []

    # add fig legend
    bb.append(leg.legendPatch.get_window_extent())

    for ax in fig.axes:
        if ax.get_visible():
            bb.append(ax.get_tightbbox(renderer))

    _bbox = Bbox.union([b for b in bb if b.width!=0 or b.height!=0])

    bbox_inches = TransformedBbox(_bbox,
                                  Affine2D().scale(1./fig.dpi))

    return bbox_inches

fig.get_tightbbox = get_tightbbox

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to