Skip to content

Commit 696929f

Browse files
committed
Add missing super __init__ to custom Norms.
The ones created by `_make_norm_from_scale` all call it.
1 parent c64e8bb commit 696929f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/matplotlib/colors.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,9 +1272,8 @@ def __init__(self, vcenter, vmin=None, vmax=None):
12721272
array([0., 0.25, 0.5, 0.625, 0.75, 0.875, 1.0])
12731273
"""
12741274

1275+
super().__init__(vmin=vmin, vmax=vmax)
12751276
self.vcenter = vcenter
1276-
self.vmin = vmin
1277-
self.vmax = vmax
12781277
if vcenter is not None and vmax is not None and vcenter >= vmax:
12791278
raise ValueError('vmin, vcenter, and vmax must be in '
12801279
'ascending order')
@@ -1353,12 +1352,10 @@ def __init__(self, vcenter=0, halfrange=None, clip=False):
13531352
>>> norm(data)
13541353
array([0.25, 0.5 , 1. ])
13551354
"""
1355+
super().__init__(vmin=None, vmax=None, clip=clip)
13561356
self._vcenter = vcenter
1357-
self.vmin = None
1358-
self.vmax = None
13591357
# calling the halfrange setter to set vmin and vmax
13601358
self.halfrange = halfrange
1361-
self.clip = clip
13621359

13631360
def _set_vmin_vmax(self):
13641361
"""
@@ -1696,9 +1693,7 @@ def __init__(self, boundaries, ncolors, clip=False, *, extend='neither'):
16961693
"""
16971694
if clip and extend != 'neither':
16981695
raise ValueError("'clip=True' is not compatible with 'extend'")
1699-
self.clip = clip
1700-
self.vmin = boundaries[0]
1701-
self.vmax = boundaries[-1]
1696+
super().__init__(vmin=boundaries[0], vmax=boundaries[-1], clip=clip)
17021697
self.boundaries = np.asarray(boundaries)
17031698
self.N = len(self.boundaries)
17041699
if self.N < 2:

0 commit comments

Comments
 (0)