Skip to content

Commit 6a1b88c

Browse files
committed
Merge remote-tracking branch 'upstream/v1.3.x'
Conflicts: lib/matplotlib/axes/_axes.py
2 parents 350320f + 5bc2357 commit 6a1b88c

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

lib/matplotlib/axes/_axes.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -5245,7 +5245,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
52455245
hist_kwargs = dict(range=bin_range)
52465246

52475247
n = []
5248-
mlast = bottom
5248+
mlast = None
52495249
for i in xrange(nx):
52505250
# this will automatically overwrite bins,
52515251
# so that each histogram uses the same bins
@@ -5257,6 +5257,8 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
52575257
db = np.diff(bins)
52585258
m = (m.astype(float) / db) / m.sum()
52595259
if stacked:
5260+
if mlast is None:
5261+
mlast = np.zeros(len(bins)-1, m.dtype)
52605262
m += mlast
52615263
mlast[:] = m
52625264
n.append(m)
@@ -5347,6 +5349,12 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
53475349
x[0:2*len(bins)-1:2], x[1:2*len(bins)-1:2] = bins, bins[:-1]
53485350
x[2*len(bins)-1:] = x[1:2*len(bins)-1][::-1]
53495351

5352+
if bottom is None:
5353+
bottom = np.zeros(len(bins)-1, np.float)
5354+
5355+
y[1:2*len(bins)-1:2], y[2:2*len(bins):2] = bottom, bottom
5356+
y[2*len(bins)-1:] = y[1:2*len(bins)-1][::-1]
5357+
53505358
if log:
53515359
if orientation == 'horizontal':
53525360
self.set_xscale('log', nonposx='clip')
@@ -5382,12 +5390,13 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
53825390

53835391
xvals, yvals = [], []
53845392
for m in n:
5385-
# starting point for drawing polygon
5386-
y[0] = y[1]
5387-
# top of the previous polygon becomes the bottom
5388-
y[2*len(bins)-1:] = y[1:2*len(bins)-1][::-1]
5393+
if stacked:
5394+
# starting point for drawing polygon
5395+
y[0] = y[1]
5396+
# top of the previous polygon becomes the bottom
5397+
y[2*len(bins)-1:] = y[1:2*len(bins)-1][::-1]
53895398
# set the top of this polygon
5390-
y[1:2*len(bins)-1:2], y[2:2*len(bins)-1:2] = m, m
5399+
y[1:2*len(bins)-1:2], y[2:2*len(bins):2] = m + bottom, m + bottom
53915400
if log:
53925401
y[y < minimum] = minimum
53935402
if orientation == 'horizontal':
Loading

lib/matplotlib/tests/test_axes.py

+9
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,15 @@ def test_hist_stacked_normed():
12071207
ax.hist((d1, d2), stacked=True, normed=True)
12081208

12091209

1210+
@image_comparison(baseline_images=['hist_step_bottom'], extensions=['png'], remove_text=True)
1211+
def test_hist_step_bottom():
1212+
# make some data
1213+
d1 = np.linspace(1, 3, 20)
1214+
fig = plt.figure()
1215+
ax = fig.add_subplot(111)
1216+
ax.hist(d1, bottom=np.arange(10), histtype="stepfilled")
1217+
1218+
12101219
@image_comparison(baseline_images=['hist_stacked_bar'])
12111220
def test_hist_stacked_bar():
12121221
# make some data

setupext.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1353,8 +1353,12 @@ def hardcoded_tcl_config(self):
13531353
def add_flags(self, ext):
13541354
if sys.platform == 'win32':
13551355
major, minor1, minor2, s, tmp = sys.version_info
1356-
ext.include_dirs.extend(['win32_static/include/tcl85'])
1357-
ext.libraries.extend(['tk85', 'tcl85'])
1356+
if sys.version_info[0:2] < (3, 4):
1357+
ext.include_dirs.extend(['win32_static/include/tcl85'])
1358+
ext.libraries.extend(['tk85', 'tcl85'])
1359+
else:
1360+
ext.include_dirs.extend(['win32_static/include/tcl86'])
1361+
ext.libraries.extend(['tk86t', 'tcl86t'])
13581362
ext.library_dirs.extend([os.path.join(sys.prefix, 'dlls')])
13591363

13601364
elif sys.platform == 'darwin':

0 commit comments

Comments
 (0)