Skip to content

Commit

Permalink
Merge pull request #3808 from tacaswell/colorbar_norm_bug
Browse files Browse the repository at this point in the history
BUG : fix #3805
  • Loading branch information
efiring authored and tacaswell committed Nov 16, 2014
1 parent 0b9e7ab commit 7ba2c2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/matplotlib/colorbar.py
Expand Up @@ -653,12 +653,14 @@ def _process_values(self, b=None):
self._values = v
return
else:
self.norm.vmin, self.norm.vmax = mtrans.nonsingular(self.norm.vmin,
self.norm.vmax,
expander=0.1)
if not self.norm.scaled():
self.norm.vmin = 0
self.norm.vmax = 1

self.norm.vmin, self.norm.vmax = mtrans.nonsingular(self.norm.vmin,
self.norm.vmax,
expander=0.1)

b = self.norm.inverse(self._uniform_y(self.cmap.N + 1))
if self._extend_lower():
b[0] = b[0] - 1
Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/tests/test_colorbar.py
Expand Up @@ -246,6 +246,13 @@ def test_remove_from_figure_no_gridspec():
_test_remove_from_figure(False)


@cleanup
def test_colorbarbase():
# smoke test from #3805
ax = plt.gca()
ColorbarBase(ax, plt.cm.bone)


if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 comments on commit 7ba2c2a

Please sign in to comment.