Skip to content

Commit

Permalink
Merge pull request matplotlib#4045 from pelson/quadmesh_big
Browse files Browse the repository at this point in the history
BUG : Fix run-away memory usage with pcolormesh + bbox_inches='tight'
  • Loading branch information
tacaswell committed Jan 31, 2015
2 parents 513ff68 + 86824c3 commit cad373f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,9 @@ def set_paths(self):
self._paths = self.convert_mesh_to_paths(
self._meshWidth, self._meshHeight, self._coordinates)

def get_datalim(self, transData):
return (self.get_transform() - transData).transform_bbox(self._bbox)

@staticmethod
def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
"""
Expand Down
9 changes: 9 additions & 0 deletions lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,15 @@ def transform_non_affine(self, values):
"""
return values

def transform_bbox(self, bbox):
"""
Transform the given bounding box.
Note, for smarter transforms including caching (a common
requirement for matplotlib figures), see :class:`TransformedBbox`.
"""
return Bbox(self.transform(bbox.get_points()))

def get_affine(self):
"""
Get the affine part of this transform.
Expand Down

0 comments on commit cad373f

Please sign in to comment.