From be37304ded90054b997c554942c6df5e96d84b74 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 2 Jul 2016 17:24:04 -0700 Subject: [PATCH] Remove a copy in pcolormesh. This slightly increases the size of the maximum pcolormesh before hitting a MemoryError. Test with N = 6000; x, y = mgrid[:N, :N]; z = sin(x + y); pcolormesh(x, y, z) The patch raises the maximum N to ~8000 on my system (depending on the load). OTOH, this probably(?) makes pcolormesh sensitive to later changes in the input array. --- lib/matplotlib/collections.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index d54fedafbd02..d117c56ff540 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -1741,7 +1741,9 @@ def __init__(self, meshWidth, meshHeight, coordinates, Collection.__init__(self, **kwargs) self._meshWidth = meshWidth self._meshHeight = meshHeight - self._coordinates = coordinates + # By converting to floats now, we can avoid that on every draw. + self._coordinates = np.asarray(coordinates, float).reshape( + (meshHeight + 1, meshWidth + 1, 2)) self._antialiased = antialiased self._shading = shading @@ -1749,11 +1751,6 @@ def __init__(self, meshWidth, meshHeight, coordinates, self._bbox.update_from_data_xy(coordinates.reshape( ((meshWidth + 1) * (meshHeight + 1), 2))) - # By converting to floats now, we can avoid that on every draw. - self._coordinates = self._coordinates.reshape( - (meshHeight + 1, meshWidth + 1, 2)) - self._coordinates = np.array(self._coordinates, float) - def get_paths(self): if self._paths is None: self.set_paths() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy