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

Skip to content

Commit 924aa61

Browse files
committed
Add get_bad, get_under, get_over.
1 parent ff821ba commit 924aa61

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/matplotlib/colors.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,13 +614,27 @@ def __copy__(self):
614614
cmapobject._global = False
615615
return cmapobject
616616

617+
def get_bad(self):
618+
"""Get the color for masked values."""
619+
if not self._isinit:
620+
self._init()
621+
return self._lut[self._i_bad]
622+
617623
def set_bad(self, color='k', alpha=None):
618624
"""Set the color for masked values."""
619625
_warn_if_global_cmap_modified(self)
620626
self._rgba_bad = to_rgba(color, alpha)
621627
if self._isinit:
622628
self._set_extremes()
623629

630+
def get_under(self):
631+
"""
632+
Get the color for low out-of-range values when ``norm.clip = False``.
633+
"""
634+
if not self._isinit:
635+
self._init()
636+
return self._lut[self._i_under]
637+
624638
def set_under(self, color='k', alpha=None):
625639
"""
626640
Set the color for low out-of-range values when ``norm.clip = False``.
@@ -630,6 +644,14 @@ def set_under(self, color='k', alpha=None):
630644
if self._isinit:
631645
self._set_extremes()
632646

647+
def get_over(self):
648+
"""
649+
Get the color for high out-of-range values when ``norm.clip = False``.
650+
"""
651+
if not self._isinit:
652+
self._init()
653+
return self._lut[self._i_over]
654+
633655
def set_over(self, color='k', alpha=None):
634656
"""
635657
Set the color for high out-of-range values when ``norm.clip = False``.

0 commit comments

Comments
 (0)