File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Original file line number Diff line number Diff line change @@ -802,8 +802,9 @@ def _process_values(self, b=None):
802
802
803
803
b = self .norm .inverse (self ._uniform_y (self .cmap .N + 1 ))
804
804
805
- if isinstance (self .norm , colors .LogNorm ):
806
- # If using a lognorm, ensure extensions don't go negative
805
+ if isinstance (self .norm , (colors .PowerNorm , colors .LogNorm )):
806
+ # If using a lognorm or powernorm, ensure extensions don't
807
+ # go negative
807
808
if self ._extend_lower ():
808
809
b [0 ] = 0.9 * b [0 ]
809
810
if self ._extend_upper ():
Original file line number Diff line number Diff line change 4
4
from matplotlib import rc_context
5
5
from matplotlib .testing .decorators import image_comparison
6
6
import matplotlib .pyplot as plt
7
- from matplotlib .colors import BoundaryNorm , LogNorm
7
+ from matplotlib .colors import BoundaryNorm , LogNorm , PowerNorm
8
8
from matplotlib .cm import get_cmap
9
9
from matplotlib .colorbar import ColorbarBase
10
10
@@ -348,6 +348,14 @@ def test_colorbar_lognorm_extension():
348
348
assert cb ._values [0 ] >= 0.0
349
349
350
350
351
+ def test_colorbar_powernorm_extension ():
352
+ # Test that colorbar with powernorm is extended correctly
353
+ f , ax = plt .subplots ()
354
+ cb = ColorbarBase (ax , norm = PowerNorm (gamma = 0.5 , vmin = 0.0 , vmax = 1.0 ),
355
+ orientation = 'vertical' , extend = 'both' )
356
+ assert cb ._values [0 ] >= 0.0
357
+
358
+
351
359
def test_colorbar_axes_kw ():
352
360
# test fix for #8493: This does only test, that axes-related keywords pass
353
361
# and do not raise an exception.
You can’t perform that action at this time.
0 commit comments