Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0ab4599

Browse filesBrowse files
tacaswellefiring
authored andcommitted
Merge pull request #6780 from Salganos/Salganos-SymLogNorm
ENH: Call _transform_vmin_vmax during SymLogNorm.__init__
1 parent 9aa02c6 commit 0ab4599
Copy full SHA for 0ab4599

File tree

Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-0
lines changed

‎lib/matplotlib/colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colors.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,8 @@ def __init__(self, linthresh, linscale=1.0,
987987
Normalize.__init__(self, vmin, vmax, clip)
988988
self.linthresh = float(linthresh)
989989
self._linscale_adj = (linscale / (1.0 - np.e ** -1))
990+
if vmin is not None and vmax is not None:
991+
self._transform_vmin_vmax()
990992

991993
def __call__(self, value, clip=None):
992994
if clip is None:

‎lib/matplotlib/tests/test_colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colors.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import matplotlib
2222
import matplotlib.colors as mcolors
2323
import matplotlib.cm as cm
24+
import matplotlib.colorbar as mcolorbar
2425
import matplotlib.cbook as cbook
2526
import matplotlib.pyplot as plt
2627
from matplotlib.testing.decorators import (image_comparison,
@@ -231,6 +232,17 @@ def test_SymLogNorm():
231232
assert_array_almost_equal(normed_vals, expected)
232233

233234

235+
@cleanup
236+
def test_SymLogNorm_colorbar():
237+
"""
238+
Test un-called SymLogNorm in a colorbar.
239+
"""
240+
norm = mcolors.SymLogNorm(0.1, vmin=-1, vmax=1, linscale=1)
241+
fig = plt.figure()
242+
cbar = mcolorbar.ColorbarBase(fig.add_subplot(111), norm=norm)
243+
plt.close(fig)
244+
245+
234246
def _inverse_tester(norm_instance, vals):
235247
"""
236248
Checks if the inverse of the given normalization is working.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.