@@ -2252,14 +2252,8 @@ class PolyQuadMesh(_MeshData, PolyCollection):
22522252 """
22532253
22542254 def __init__ (self , coordinates , ** kwargs ):
2255- # We need to keep track of whether we are using deprecated compression
2256- # Update it after the initializers
2257- self ._deprecated_compression = False
22582255 super ().__init__ (coordinates = coordinates )
22592256 PolyCollection .__init__ (self , verts = [], ** kwargs )
2260- # Store this during the compression deprecation period
2261- self ._original_mask = ~ self ._get_unmasked_polys ()
2262- self ._deprecated_compression = np .any (self ._original_mask )
22632257 # Setting the verts updates the paths of the PolyCollection
22642258 # This is called after the initializers to make sure the kwargs
22652259 # have all been processed and available for the masking calculations
@@ -2272,14 +2266,7 @@ def _get_unmasked_polys(self):
22722266
22732267 # We want the shape of the polygon, which is the corner of each X/Y array
22742268 mask = (mask [0 :- 1 , 0 :- 1 ] | mask [1 :, 1 :] | mask [0 :- 1 , 1 :] | mask [1 :, 0 :- 1 ])
2275-
2276- if (getattr (self , "_deprecated_compression" , False ) and
2277- np .any (self ._original_mask )):
2278- return ~ (mask | self ._original_mask )
2279- # Take account of the array data too, temporarily avoiding
2280- # the compression warning and resetting the variable after the call
2281- with cbook ._setattr_cm (self , _deprecated_compression = False ):
2282- arr = self .get_array ()
2269+ arr = self .get_array ()
22832270 if arr is not None :
22842271 arr = np .ma .getmaskarray (arr )
22852272 if arr .ndim == 3 :
@@ -2335,42 +2322,8 @@ def get_facecolor(self):
23352322 def set_array (self , A ):
23362323 # docstring inherited
23372324 prev_unmask = self ._get_unmasked_polys ()
2338- # MPL <3.8 compressed the mask, so we need to handle flattened 1d input
2339- # until the deprecation expires, also only warning when there are masked
2340- # elements and thus compression occurring.
2341- if self ._deprecated_compression and np .ndim (A ) == 1 :
2342- _api .warn_deprecated ("3.8" , message = "Setting a PolyQuadMesh array using "
2343- "the compressed values is deprecated. "
2344- "Pass the full 2D shape of the original array "
2345- f"{ prev_unmask .shape } including the masked elements." )
2346- Afull = np .empty (self ._original_mask .shape )
2347- Afull [~ self ._original_mask ] = A
2348- # We also want to update the mask with any potential
2349- # new masked elements that came in. But, we don't want
2350- # to update any of the compression from the original
2351- mask = self ._original_mask .copy ()
2352- mask [~ self ._original_mask ] |= np .ma .getmask (A )
2353- A = np .ma .array (Afull , mask = mask )
2354- return super ().set_array (A )
2355- self ._deprecated_compression = False
23562325 super ().set_array (A )
23572326 # If the mask has changed at all we need to update
23582327 # the set of Polys that we are drawing
23592328 if not np .array_equal (prev_unmask , self ._get_unmasked_polys ()):
23602329 self ._set_unmasked_verts ()
2361-
2362- def get_array (self ):
2363- # docstring inherited
2364- # Can remove this entire function once the deprecation period ends
2365- A = super ().get_array ()
2366- if A is None :
2367- return
2368- if self ._deprecated_compression and np .any (np .ma .getmask (A )):
2369- _api .warn_deprecated ("3.8" , message = (
2370- "Getting the array from a PolyQuadMesh will return the full "
2371- "array in the future (uncompressed). To get this behavior now "
2372- "set the PolyQuadMesh with a 2D array .set_array(data2d)." ))
2373- # Setting an array of a polycollection required
2374- # compressing the array
2375- return np .ma .compressed (A )
2376- return A
0 commit comments