File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,18 @@ def test_SymLogNorm_colorbar():
247
247
plt .close (fig )
248
248
249
249
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
+
250
262
def _inverse_tester (norm_instance , vals ):
251
263
"""
252
264
Checks if the inverse of the given normalization is working.
Original file line number Diff line number Diff line change @@ -2346,7 +2346,10 @@ def get_log_range(lo, hi):
2346
2346
if len (subs ) > 1 or subs [0 ] != 1.0 :
2347
2347
ticklocs = []
2348
2348
for decade in decades :
2349
- ticklocs .extend (subs * decade )
2349
+ if decade == 0 :
2350
+ ticklocs .append (decade )
2351
+ else :
2352
+ ticklocs .extend (subs * decade )
2350
2353
else :
2351
2354
ticklocs = decades
2352
2355
You can’t perform that action at this time.
0 commit comments