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 @@ -828,8 +828,9 @@ def _process_values(self, b=None):
828
828
829
829
b = self .norm .inverse (self ._uniform_y (self .cmap .N + 1 ))
830
830
831
- if isinstance (self .norm , colors .LogNorm ):
832
- # If using a lognorm, ensure extensions don't go negative
831
+ if isinstance (self .norm , (colors .PowerNorm , colors .LogNorm )):
832
+ # If using a lognorm or powernorm, ensure extensions don't
833
+ # go negative
833
834
if self ._extend_lower ():
834
835
b [0 ] = 0.9 * b [0 ]
835
836
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
@@ -372,6 +372,14 @@ def test_colorbar_lognorm_extension():
372
372
assert cb ._values [0 ] >= 0.0
373
373
374
374
375
+ def test_colorbar_powernorm_extension ():
376
+ # Test that colorbar with powernorm is extended correctly
377
+ f , ax = plt .subplots ()
378
+ cb = ColorbarBase (ax , norm = PowerNorm (gamma = 0.5 , vmin = 0.0 , vmax = 1.0 ),
379
+ orientation = 'vertical' , extend = 'both' )
380
+ assert cb ._values [0 ] >= 0.0
381
+
382
+
375
383
def test_colorbar_axes_kw ():
376
384
# test fix for #8493: This does only test, that axes-related keywords pass
377
385
# and do not raise an exception.
You can’t perform that action at this time.
0 commit comments