Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92766bb

Browse files
committed
Merge pull request matplotlib#2428 from cpelley/symlognorm_fix
BUG: Fixed object type missmatch in SymLogNorm
2 parents 6fc76e3 + d3dba08 commit 92766bb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/matplotlib/colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ def __init__(self, linthresh, linscale=1.0,
10551055
the logarithmic range. Defaults to 1.
10561056
"""
10571057
Normalize.__init__(self, vmin, vmax, clip)
1058-
self.linthresh = linthresh
1058+
self.linthresh = float(linthresh)
10591059
self._linscale_adj = (linscale / (1.0 - np.e ** -1))
10601060

10611061
def __call__(self, value, clip=None):
@@ -1113,7 +1113,7 @@ def _transform_vmin_vmax(self):
11131113
Calculates vmin and vmax in the transformed system.
11141114
"""
11151115
vmin, vmax = self.vmin, self.vmax
1116-
arr = np.array([vmax, vmin])
1116+
arr = np.array([vmax, vmin]).astype(np.float)
11171117
self._upper, self._lower = self._transform(arr)
11181118

11191119
def inverse(self, value):

lib/matplotlib/tests/test_colors.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ def test_SymLogNorm():
7676
_scalar_tester(norm, vals)
7777
_mask_tester(norm, vals)
7878

79+
# Ensure that specifying vmin returns the same result as above
80+
norm = mcolors.SymLogNorm(3, vmin=-30, vmax=5, linscale=1.2)
81+
normed_vals = norm(vals)
82+
assert_array_almost_equal(normed_vals, expected)
83+
7984

8085
def _inverse_tester(norm_instance, vals):
8186
"""

0 commit comments

Comments
 (0)