Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b69acdd

Browse files
committed
Change default to clip=False in Normalize.__init__
svn path=/trunk/matplotlib/; revision=3412
1 parent 2788e55 commit b69acdd

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

API_CHANGES

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
Made the emit property of set_xlim and set_ylim true by default;
2-
removed the Axes custom callback handling into a 'callbacks'
3-
attribute which is a cbook.CallbackRegistry instance. This now
4-
supports the xlim_changed and ylim_changed Axes events.
1+
Changed default kwarg in colors.Normalize.__init__ to clip=False;
2+
clipping silently defeats the purpose of the special over, under,
3+
and bad values in the colormap, thereby leading to unexpected
4+
behavior. The new default should reduce such surprises.
5+
6+
Made the emit property of set_xlim and set_ylim true by default;
7+
removed the Axes custom callback handling into a 'callbacks'
8+
attribute which is a cbook.CallbackRegistry instance. This now
9+
supports the xlim_changed and ylim_changed Axes events.
510

611
0.90.1 released
712

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2007-06-25 Changed default to clip=False in colors.Normalize;
2+
modified ColorbarBase for easier colormap display - EF
3+
14
2007-06-13 Added maskedarray option to rc, numerix - EF
25

36
2007-06-11 Python 2.5 compatibility fix for mlab.py - EF

lib/matplotlib/colors.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,18 @@ class Normalize:
561561
"""
562562
Normalize a given value to the 0-1 range
563563
"""
564-
def __init__(self, vmin=None, vmax=None, clip = True):
564+
def __init__(self, vmin=None, vmax=None, clip=False):
565565
"""
566566
If vmin or vmax is not given, they are taken from the input's
567567
minimum and maximum value respectively. If clip is True and
568568
the given value falls outside the range, the returned value
569569
will be 0 or 1, whichever is closer. Returns 0 if vmin==vmax.
570570
Works with scalars or arrays, including masked arrays. If
571571
clip is True, masked values are set to 1; otherwise they
572-
remain masked.
572+
remain masked. Clipping silently defeats the purpose of setting
573+
the over, under, and masked colors in the colormap, so it is
574+
likely to lead to surprises; therefore the default is
575+
clip=False.
573576
"""
574577
self.vmin = vmin
575578
self.vmax = vmax

0 commit comments

Comments
 (0)