Skip to content

Commit cad373f

Browse files
committed
Merge pull request #4045 from pelson/quadmesh_big
BUG : Fix run-away memory usage with pcolormesh + bbox_inches='tight'
2 parents 513ff68 + 86824c3 commit cad373f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/matplotlib/collections.py

+3
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,9 @@ def set_paths(self):
17051705
self._paths = self.convert_mesh_to_paths(
17061706
self._meshWidth, self._meshHeight, self._coordinates)
17071707

1708+
def get_datalim(self, transData):
1709+
return (self.get_transform() - transData).transform_bbox(self._bbox)
1710+
17081711
@staticmethod
17091712
def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
17101713
"""

lib/matplotlib/transforms.py

+9
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,15 @@ def transform_non_affine(self, values):
13441344
"""
13451345
return values
13461346

1347+
def transform_bbox(self, bbox):
1348+
"""
1349+
Transform the given bounding box.
1350+
1351+
Note, for smarter transforms including caching (a common
1352+
requirement for matplotlib figures), see :class:`TransformedBbox`.
1353+
"""
1354+
return Bbox(self.transform(bbox.get_points()))
1355+
13471356
def get_affine(self):
13481357
"""
13491358
Get the affine part of this transform.

0 commit comments

Comments
 (0)