1111import matplotlib as mpl
1212import numpy as np
1313from numpy import ma
14- import matplotlib ._cntr as _cntr
1514import matplotlib ._contour as _contour
1615import matplotlib .path as mpath
1716import matplotlib .ticker as ticker
@@ -1171,10 +1170,7 @@ def _contour_level_args(self, z, args):
11711170 raise ValueError ("Filled contours require at least 2 levels." )
11721171
11731172 if len (self .levels ) > 1 and np .min (np .diff (self .levels )) <= 0.0 :
1174- if hasattr (self , '_corner_mask' ) and self ._corner_mask == 'legacy' :
1175- warnings .warn ("Contour levels are not increasing" )
1176- else :
1177- raise ValueError ("Contour levels must be increasing" )
1173+ raise ValueError ("Contour levels must be increasing" )
11781174
11791175 @property
11801176 def vmin (self ):
@@ -1419,10 +1415,7 @@ def _process_args(self, *args, **kwargs):
14191415 self .zmin = args [0 ].zmin
14201416 self .zmax = args [0 ].zmax
14211417 self ._corner_mask = args [0 ]._corner_mask
1422- if self ._corner_mask == 'legacy' :
1423- contour_generator = args [0 ].Cntr
1424- else :
1425- contour_generator = args [0 ]._contour_generator
1418+ contour_generator = args [0 ]._contour_generator
14261419 self ._mins = args [0 ]._mins
14271420 self ._maxs = args [0 ]._maxs
14281421 else :
@@ -1436,14 +1429,8 @@ def _process_args(self, *args, **kwargs):
14361429 if _mask is ma .nomask or not _mask .any ():
14371430 _mask = None
14381431
1439- if self ._corner_mask == 'legacy' :
1440- cbook .warn_deprecated ('1.5' ,
1441- name = "corner_mask='legacy'" ,
1442- alternative = 'corner_mask=False or True' )
1443- contour_generator = _cntr .Cntr (x , y , z .filled (), _mask )
1444- else :
1445- contour_generator = _contour .QuadContourGenerator (
1446- x , y , z .filled (), _mask , self ._corner_mask , self .nchunk )
1432+ contour_generator = _contour .QuadContourGenerator (
1433+ x , y , z .filled (), _mask , self ._corner_mask , self .nchunk )
14471434
14481435 t = self .get_transform ()
14491436
@@ -1460,43 +1447,26 @@ def _process_args(self, *args, **kwargs):
14601447 self ._mins = [ma .min (x ), ma .min (y )]
14611448 self ._maxs = [ma .max (x ), ma .max (y )]
14621449
1463- if self ._corner_mask == 'legacy' :
1464- self .Cntr = contour_generator
1465- else :
1466- self ._contour_generator = contour_generator
1450+ self ._contour_generator = contour_generator
14671451
14681452 return kwargs
14691453
14701454 def _get_allsegs_and_allkinds (self ):
1471- """
1472- Create and return allsegs and allkinds by calling underlying C code.
1473- """
1455+ """Compute ``allsegs`` and ``allkinds`` using C extension."""
14741456 allsegs = []
14751457 if self .filled :
14761458 lowers , uppers = self ._get_lowers_and_uppers ()
14771459 allkinds = []
14781460 for level , level_upper in zip (lowers , uppers ):
1479- if self ._corner_mask == 'legacy' :
1480- nlist = self .Cntr .trace (level , level_upper ,
1481- nchunk = self .nchunk )
1482- nseg = len (nlist ) // 2
1483- vertices = nlist [:nseg ]
1484- kinds = nlist [nseg :]
1485- else :
1486- vertices , kinds = \
1487- self ._contour_generator .create_filled_contour (
1488- level , level_upper )
1461+ vertices , kinds = \
1462+ self ._contour_generator .create_filled_contour (
1463+ level , level_upper )
14891464 allsegs .append (vertices )
14901465 allkinds .append (kinds )
14911466 else :
14921467 allkinds = None
14931468 for level in self .levels :
1494- if self ._corner_mask == 'legacy' :
1495- nlist = self .Cntr .trace (level )
1496- nseg = len (nlist ) // 2
1497- vertices = nlist [:nseg ]
1498- else :
1499- vertices = self ._contour_generator .create_contour (level )
1469+ vertices = self ._contour_generator .create_contour (level )
15001470 allsegs .append (vertices )
15011471 return allsegs , allkinds
15021472
@@ -1687,19 +1657,15 @@ def _initialize_x_y(self, z):
16871657
16881658 Optional keyword arguments:
16891659
1690- *corner_mask*: [ *True* | *False* | 'legacy' ]
1660+ *corner_mask*: bool, optional
16911661 Enable/disable corner masking, which only has an effect if *Z* is
1692- a masked array. If * False* , any quad touching a masked point is
1693- masked out. If * True* , only the triangular corners of quads
1662+ a masked array. If `` False`` , any quad touching a masked point is
1663+ masked out. If `` True`` , only the triangular corners of quads
16941664 nearest those points are always masked out, other triangular
16951665 corners comprising three unmasked points are contoured as usual.
1696- If 'legacy', the old contouring algorithm is used, which is
1697- equivalent to *False* and is deprecated, only remaining whilst the
1698- new algorithm is tested fully.
16991666
1700- If not specified, the default is taken from
1701- rcParams['contour.corner_mask'], which is True unless it has
1702- been modified.
1667+ Defaults to ``rcParams['contour.corner_mask']``, which defaults to
1668+ ``True``.
17031669
17041670 *colors*: [ *None* | string | (mpl_colors) ]
17051671 If *None*, the colormap specified by cmap will be used.
0 commit comments