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 1bad2eb

Browse filesBrowse files
committed
Add test
1 parent 41d7e12 commit 1bad2eb
Copy full SHA for 1bad2eb

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+34
-0
lines changed

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4157,6 +4157,40 @@ def test_loglog():
41574157
ax.tick_params(length=15, width=2, which='minor')
41584158

41594159

4160+
@cleanup('default')
4161+
def test_axes_margins():
4162+
fig, ax = plt.subplots()
4163+
ax.plot([0, 1, 2, 3])
4164+
assert ax.get_ybound()[0] != 0
4165+
4166+
fig, ax = plt.subplots()
4167+
ax.bar([0, 1, 2, 3], [1, 1, 1, 1])
4168+
assert ax.get_ybound()[0] == 0
4169+
4170+
fig, ax = plt.subplots()
4171+
ax.barh([0, 1, 2, 3], [1, 1, 1, 1])
4172+
assert ax.get_xbound()[0] == 0
4173+
4174+
fig, ax = plt.subplots()
4175+
ax.pcolor(np.zeros((10, 10)))
4176+
assert ax.get_xbound() == (0, 10)
4177+
assert ax.get_ybound() == (0, 10)
4178+
4179+
fig, ax = plt.subplots()
4180+
ax.pcolorfast(np.zeros((10, 10)))
4181+
assert ax.get_xbound() == (0, 10)
4182+
assert ax.get_ybound() == (0, 10)
4183+
4184+
fig, ax = plt.subplots()
4185+
ax.hist(np.arange(10))
4186+
assert ax.get_ybound()[0] == 0
4187+
4188+
fig, ax = plt.subplots()
4189+
ax.imshow(np.zeros((10, 10)))
4190+
assert ax.get_xbound() == (-0.5, 9.5)
4191+
assert ax.get_ybound() == (-0.5, 9.5)
4192+
4193+
41604194
if __name__ == '__main__':
41614195
import nose
41624196
import sys

0 commit comments

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