Skip to content

AnchoredOffsetBox not taken into account by bbox_inches='tight' #2530

@minrk

Description

@minrk

I don't know if this is intended behavior, but an AnchoredOffsetBox outside the axes will be cut off if bbox_inches='tight'.

To reproduce:

from matplotlib.offsetbox import AnchoredOffsetbox, TextArea

ax = plt.gca()
ax.plot([0,1])
anchored_box = AnchoredOffsetbox(
    loc=6,
    child=TextArea("hello"),
    frameon=True,
    bbox_to_anchor=(1, 0.8),
    bbox_transform=ax.transAxes,
)
ax.add_artist(anchored_box)

plt.gcf().canvas.print_figure('test.png', format='png', bbox_inches='tight')

gives

test

This is reproduced with current master (8162371).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions