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

Skip to content

Commit e9af134

Browse files
committed
adding test for SymLogNorm single zero fix
1 parent 7fe5e4e commit e9af134

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_colors.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,18 @@ def test_SymLogNorm_colorbar():
247247
plt.close(fig)
248248

249249

250+
def test_SymLogNorm_single_zero():
251+
"""
252+
Test SymLogNorm to ensure it is not adding sub-ticks to zero label
253+
"""
254+
fig = plt.figure()
255+
norm = mcolors.SymLogNorm(1e-5, vmin=-1, vmax=1)
256+
cbar = mcolorbar.ColorbarBase(fig.add_subplot(111), norm=norm)
257+
ticks = cbar.get_ticks()
258+
assert sum(ticks == 0) == 1
259+
plt.close(fig)
260+
261+
250262
def _inverse_tester(norm_instance, vals):
251263
"""
252264
Checks if the inverse of the given normalization is working.

0 commit comments

Comments
 (0)