Skip to content

Commit

Permalink
Fox objects for PathCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
Phlya committed Mar 18, 2024
1 parent f55b83c commit 8a4d608
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions adjustText/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def get_bboxes_pathcollection(sc, ax):
result = get_path_collection_extents(
transform.frozen(), [p], [t], [o], transOffset.frozen()
)
bboxes.append(result)
bboxes.append(result.transformed(ax.transData.inverted()))

return bboxes


def get_bboxes(objs, r=None, expand=(1, 1), ax=None, transform=None):
def get_bboxes(objs, r=None, expand=(1, 1), ax=None):
"""
Expand All @@ -98,9 +98,6 @@ def get_bboxes(objs, r=None, expand=(1, 1), ax=None, transform=None):
How much to expand bboxes in (x, y), in fractions. The default is (1, 1).
ax : Axes, optional
The default is None, then uses current axes.
transform : optional
Transform to apply to the objects, if they don't return they window extent.
The default is None, then applies the default ax transform.
Returns
-------
Expand All @@ -110,6 +107,11 @@ def get_bboxes(objs, r=None, expand=(1, 1), ax=None, transform=None):
"""
ax = ax or plt.gca()
r = r or get_renderer(ax.get_figure())
try:
objs = [i.get_bbox() for i in objs]
except (AttributeError, TypeError):
pass

try:
return [i.get_window_extent(r).expanded(*expand) for i in objs]
except (AttributeError, TypeError):
Expand Down

0 comments on commit 8a4d608

Please sign in to comment.