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 ee512a5

Browse filesBrowse files
committed
plt.box_bug_fix
1 parent cd1ae80 commit ee512a5
Copy full SHA for ee512a5

File tree

Expand file treeCollapse file tree

2 files changed

+21
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-4
lines changed

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,20 +1282,25 @@ def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
12821282

12831283
def box(on=None):
12841284
"""
1285-
Turn the axes box on or off.
1285+
Turn the axes box on or off on the current axes.
12861286
12871287
Parameters
12881288
----------
12891289
on : bool or None
1290-
The new axes box state. If ``None``, toggle the state.
1290+
The new `~matplotlib.axes.Axes` box state. If ``None``, toggle
1291+
the state.
1292+
1293+
See Also
1294+
--------
1295+
:meth:`matplotlib.axes.Axes.set_frame_on`
1296+
:meth:`matplotlib.axes.Axes.get_frame_on`
12911297
"""
12921298
ax = gca()
1293-
on = _string_to_bool(on)
12941299
if on is None:
12951300
on = not ax.get_frame_on()
1301+
on = _string_to_bool(on)
12961302
ax.set_frame_on(on)
12971303

1298-
12991304
## Axis ##
13001305

13011306

‎lib/matplotlib/tests/test_pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_pyplot.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,15 @@ def test_pyplot_up_to_date():
1919
assert orig_contents == new_contents
2020
finally:
2121
Path(plt.__file__).write_text(orig_contents)
22+
23+
24+
def test_pyplot_box():
25+
fig, ax = plt.subplots()
26+
plt.box(False)
27+
assert not ax.get_frame_on()
28+
plt.box(True)
29+
assert ax.get_frame_on()
30+
plt.box()
31+
assert not ax.get_frame_on()
32+
plt.box()
33+
assert ax.get_frame_on()

0 commit comments

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