Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72f72eb

Browse filesBrowse files
test_hist_log_bottom: new test to check #4606
- this new test checks that the `bottom` kwarg to `Axes.hist` behaves as expected under a variety of circumstances when `log=True, histtype='step{filled}' given
1 parent 54ec514 commit 72f72eb
Copy full SHA for 72f72eb

File tree

Expand file treeCollapse file tree

2 files changed

+24
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+24
-0
lines changed
Loading

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,30 @@ def test_hist_steplog():
10821082
plt.hist(data_big, 100, histtype='stepfilled', log=True, orientation='horizontal')
10831083

10841084

1085+
@image_comparison(baseline_images=['hist_step_log_bottom'],
1086+
remove_text=True, extensions=['png'])
1087+
def test_hist_step_log_bottom():
1088+
# check that bottom doesn't get overwritten by the 'minimum' on a
1089+
# log scale histogram (https://github.com/matplotlib/matplotlib/pull/4608)
1090+
np.random.seed(0)
1091+
data = np.random.standard_normal(2000)
1092+
fig = plt.figure()
1093+
ax = fig.add_subplot(111)
1094+
# normal hist (should clip minimum to 1/base)
1095+
ax.hist(data, bins=10, log=True, histtype='stepfilled',
1096+
alpha=0.5, color='b')
1097+
# manual bottom < 1/base (previously buggy, see #4608)
1098+
ax.hist(data, bins=10, log=True, histtype='stepfilled',
1099+
alpha=0.5, color='g', bottom=1e-2)
1100+
# manual bottom > 1/base
1101+
ax.hist(data, bins=10, log=True, histtype='stepfilled',
1102+
alpha=0.5, color='r', bottom=0.5)
1103+
# array bottom with some less than 1/base (should clip to 1/base)
1104+
ax.hist(data, bins=10, log=True, histtype='stepfilled',
1105+
alpha=0.5, color='y', bottom=np.arange(10))
1106+
ax.set_ylim(9e-3, 1e3)
1107+
1108+
10851109
def contour_dat():
10861110
x = np.linspace(-3, 5, 150)
10871111
y = np.linspace(-3, 5, 120)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.