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

Skip to content

Commit 0163652

Browse files
jenshnielsentacaswell
authored andcommitted
Make sure that we have at least one loc before calculating as suggested by @mdboom
1 parent 7cea22c commit 0163652

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/matplotlib/ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def _set_offset(self, range):
563563
locs = np.asarray(locs)
564564
locs = locs[(vmin <= locs) & (locs <= vmax)]
565565
ave_loc = np.mean(locs)
566-
if ave_loc: # dont want to take log10(0)
566+
if len(locs) and ave_loc: # dont want to take log10(0)
567567
ave_oom = math.floor(math.log10(np.mean(np.absolute(locs))))
568568
range_oom = math.floor(math.log10(range))
569569

0 commit comments

Comments
 (0)