Skip to content

Commit 7ba2c2a

Browse files
efiringtacaswell
authored andcommitted
Merge pull request #3808 from tacaswell/colorbar_norm_bug
BUG : fix #3805
1 parent 0b9e7ab commit 7ba2c2a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/matplotlib/colorbar.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,14 @@ def _process_values(self, b=None):
653653
self._values = v
654654
return
655655
else:
656-
self.norm.vmin, self.norm.vmax = mtrans.nonsingular(self.norm.vmin,
657-
self.norm.vmax,
658-
expander=0.1)
659656
if not self.norm.scaled():
660657
self.norm.vmin = 0
661658
self.norm.vmax = 1
659+
660+
self.norm.vmin, self.norm.vmax = mtrans.nonsingular(self.norm.vmin,
661+
self.norm.vmax,
662+
expander=0.1)
663+
662664
b = self.norm.inverse(self._uniform_y(self.cmap.N + 1))
663665
if self._extend_lower():
664666
b[0] = b[0] - 1

lib/matplotlib/tests/test_colorbar.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ def test_remove_from_figure_no_gridspec():
246246
_test_remove_from_figure(False)
247247

248248

249+
@cleanup
250+
def test_colorbarbase():
251+
# smoke test from #3805
252+
ax = plt.gca()
253+
ColorbarBase(ax, plt.cm.bone)
254+
255+
249256
if __name__ == '__main__':
250257
import nose
251258
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)