From 44ff97e30c03afe6a340b3d256bd04efff5808d0 Mon Sep 17 00:00:00 2001 From: Phil Elson Date: Wed, 28 Jan 2015 09:22:36 +0000 Subject: [PATCH] Fixed large pcolormesh rendering with bbox_inches='tight'. --- lib/matplotlib/collections.py | 3 +++ lib/matplotlib/transforms.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 3e781d3602e8..e84bd3e578d3 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -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): """ diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 4fc5baead860..5956795fa6f9 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -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.transform(bbox.get_points())) + def get_affine(self): """ Get the affine part of this transform.