99line segments).
1010"""
1111
12- import inspect
1312import math
1413from numbers import Number
1514import warnings
@@ -1923,62 +1922,15 @@ class QuadMesh(Collection):
19231922 i.e. `~.Artist.contains` checks whether the test point is within any of the
19241923 mesh quadrilaterals.
19251924
1926- There exists a deprecated API version ``QuadMesh(M, N, coords)``, where
1927- the dimensions are given explicitly and ``coords`` is a (M*N, 2)
1928- array-like. This has been deprecated in Matplotlib 3.5. The following
1929- describes the semantics of this deprecated API.
1930-
1931- A quadrilateral mesh consists of a grid of vertices.
1932- The dimensions of this array are (*meshWidth* + 1, *meshHeight* + 1).
1933- Each vertex in the mesh has a different set of "mesh coordinates"
1934- representing its position in the topology of the mesh.
1935- For any values (*m*, *n*) such that 0 <= *m* <= *meshWidth*
1936- and 0 <= *n* <= *meshHeight*, the vertices at mesh coordinates
1937- (*m*, *n*), (*m*, *n* + 1), (*m* + 1, *n* + 1), and (*m* + 1, *n*)
1938- form one of the quadrilaterals in the mesh. There are thus
1939- (*meshWidth* * *meshHeight*) quadrilaterals in the mesh. The mesh
1940- need not be regular and the polygons need not be convex.
1941-
1942- A quadrilateral mesh is represented by a (2 x ((*meshWidth* + 1) *
1943- (*meshHeight* + 1))) numpy array *coordinates*, where each row is
1944- the *x* and *y* coordinates of one of the vertices. To define the
1945- function that maps from a data point to its corresponding color,
1946- use the :meth:`set_cmap` method. Each of these arrays is indexed in
1947- row-major order by the mesh coordinates of the vertex (or the mesh
1948- coordinates of the lower left vertex, in the case of the colors).
1949-
1950- For example, the first entry in *coordinates* is the coordinates of the
1951- vertex at mesh coordinates (0, 0), then the one at (0, 1), then at (0, 2)
1952- .. (0, meshWidth), (1, 0), (1, 1), and so on.
19531925 """
19541926
1955- def __init__ (self , * args , ** kwargs ):
1956- # signature deprecation since="3.5": Change to new signature after the
1957- # deprecation has expired. Also remove setting __init__.__signature__,
1958- # and remove the Notes from the docstring.
1959- params = _api .select_matching_signature (
1960- [
1961- lambda meshWidth , meshHeight , coordinates , antialiased = True ,
1962- shading = 'flat' , ** kwargs : locals (),
1963- lambda coordinates , antialiased = True , shading = 'flat' , ** kwargs :
1964- locals ()
1965- ],
1966- * args , ** kwargs ).values ()
1967- * old_w_h , coords , antialiased , shading , kwargs = params
1968- if old_w_h : # The old signature matched.
1969- _api .warn_deprecated (
1970- "3.5" ,
1971- message = "This usage of Quadmesh is deprecated: Parameters "
1972- "meshWidth and meshHeights will be removed; "
1973- "coordinates must be 2D; all parameters except "
1974- "coordinates will be keyword-only." )
1975- w , h = old_w_h
1976- coords = np .asarray (coords , np .float64 ).reshape ((h + 1 , w + 1 , 2 ))
1927+ def __init__ (self , coordinates , * , antialiased = True , shading = 'flat' ,
1928+ ** kwargs ):
19771929 kwargs .setdefault ("pickradius" , 0 )
19781930 # end of signature deprecation code
19791931
1980- _api .check_shape ((None , None , 2 ), coordinates = coords )
1981- self ._coordinates = coords
1932+ _api .check_shape ((None , None , 2 ), coordinates = coordinates )
1933+ self ._coordinates = coordinates
19821934 self ._antialiased = antialiased
19831935 self ._shading = shading
19841936 self ._bbox = transforms .Bbox .unit ()
@@ -1988,11 +1940,6 @@ def __init__(self, *args, **kwargs):
19881940 super ().__init__ (** kwargs )
19891941 self .set_mouseover (False )
19901942
1991- # Only needed during signature deprecation
1992- __init__ .__signature__ = inspect .signature (
1993- lambda self , coordinates , * ,
1994- antialiased = True , shading = 'flat' , pickradius = 0 , ** kwargs : None )
1995-
19961943 def get_paths (self ):
19971944 if self ._paths is None :
19981945 self .set_paths ()
@@ -2036,11 +1983,10 @@ def set_array(self, A):
20361983 faulty_data = True
20371984
20381985 if misshapen_data :
2039- _api .warn_deprecated (
2040- "3.5" , message = f"For X ({ width } ) and Y ({ height } ) "
2041- f"with { self ._shading } shading, the expected shape of "
2042- f"A is ({ h } , { w } ). Passing A ({ A .shape } ) is deprecated "
2043- "since %(since)s and will become an error %(removal)s." )
1986+ raise ValueError (
1987+ f"For X ({ width } ) and Y ({ height } ) with { self ._shading } "
1988+ f"shading, the expected shape of A is ({ h } , { w } ), not "
1989+ f"{ A .shape } " )
20441990
20451991 if faulty_data :
20461992 raise TypeError (
0 commit comments