Skip to content

Commit 5f942c8

Browse files
committed
hist: correct minimum stickies for log case; remove unneeded code
1 parent fbf97d4 commit 5f942c8

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

lib/matplotlib/axes/_axes.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -6322,19 +6322,19 @@ def _normalize_input(inp, ename='input'):
63226322
if np.min(bottom) > 0:
63236323
minimum = np.min(bottom)
63246324
elif normed or weights is not None:
6325-
# For normed data, set to log base * minimum data value
6325+
# For normed data, set to minimum data value / logbase
63266326
# (gives 1 full tick-label unit for the lowest filled bin)
63276327
ndata = np.array(n)
63286328
minimum = (np.min(ndata[ndata > 0])) / logbase
63296329
else:
6330-
# For non-normed data, set the min to log base,
6330+
# For non-normed data, set the min to 1 / log base,
63316331
# again so that there is 1 full tick-label unit
63326332
# for the lowest bin
63336333
minimum = 1.0 / logbase
63346334

63356335
y[0], y[-1] = minimum, minimum
63366336
else:
6337-
minimum = 0 # np.min(bins)
6337+
minimum = 0
63386338

63396339
if align == 'left' or align == 'center':
63406340
x -= 0.5*(bins[1]-bins[0])
@@ -6379,9 +6379,9 @@ def _normalize_input(inp, ename='input'):
63796379
for patch_list in patches:
63806380
for patch in patch_list:
63816381
if orientation == 'vertical':
6382-
patch.stickies.y.append(0)
6382+
patch.stickies.y.append(minimum)
63836383
elif orientation == 'horizontal':
6384-
patch.stickies.x.append(0)
6384+
patch.stickies.x.append(minimum)
63856385

63866386
# we return patches, so put it back in the expected order
63876387
patches.reverse()
@@ -6408,14 +6408,6 @@ def _normalize_input(inp, ename='input'):
64086408
p.update(kwargs)
64096409
p.set_label('_nolegend_')
64106410

6411-
if binsgiven:
6412-
if orientation == 'vertical':
6413-
self.update_datalim(
6414-
[(bins[0], 0), (bins[-1], 0)], updatey=False)
6415-
else:
6416-
self.update_datalim(
6417-
[(0, bins[0]), (0, bins[-1])], updatex=False)
6418-
64196411
if nx == 1:
64206412
return n[0], bins, cbook.silent_list('Patch', patches[0])
64216413
else:

0 commit comments

Comments
 (0)