8000 Make sure that we have at least one loc before calculating as suggest… · robintw/matplotlib@0163652 · GitHub
[go: up one dir, main page]

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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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< 4FB9 span class="diff-text-marker">-
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)
0