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 ddcf618

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

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+18
-0
lines changed

‎lib/matplotlib/tests/test_figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_figure.py
+18Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.