8000 Add a test for setting the figure width/height · matplotlib/matplotlib@ddcf618 · GitHub
[go: up one dir, main page]

Skip to content

Commit ddcf618

Browse files
committed
Add a test for setting the figure width/height
1 parent ee1a599 commit ddcf618

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/matplotlib/tests/test_figure.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@ def _as_mpl_axes(self):
158158
plt.close(fig)
159159

160160

161+
@cleanup
162+
def test_set_fig_size():
163+
fig = plt.figure()
164+
165+
# check figwidth
166+
fig.set_figwidth(5)
167+
assert_equal(fig.get_figwidth(), 5)
168+
169+
# check figheight
170+
fig.set_figheight(1)
171+
assert_equal(fig.get_figheight(), 1)
172+
173+
# check using set_size_inches
174+
fig.set_size_inches(2, 4)
175+
assert_equal(fig.get_figwidth(), 2)
176+
assert_equal(fig.get_figheight(), 4)
177+
178+
161179
if __name__ == "__main__":
162180
import nose
163181
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)
0