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 fe65745

Browse filesBrowse files
authored
Merge pull request matplotlib#11419 from timhoffm/v2.2.x
Backport PR matplotlib#11409: plt.box_bug_fix
2 parents 00555c2 + ccce7b4 commit fe65745
Copy full SHA for fe65745

File tree

Expand file treeCollapse file tree

2 files changed

+22
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+22
-3
lines changed

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,17 +1354,23 @@ def tight_layout(pad=1.08, h_pad=None, w_pad=None, rect=None):
13541354

13551355
def box(on=None):
13561356
"""
1357-
Turn the axes box on or off.
1357+
Turn the axes box on or off on the current axes.
13581358
13591359
Parameters
13601360
----------
13611361
on : bool or None
1362-
The new axes box state. If ``None``, toggle the state.
1362+
The new `~matplotlib.axes.Axes` box state. If ``None``, toggle
1363+
the state.
1364+
1365+
See Also
1366+
--------
1367+
:meth:`matplotlib.axes.Axes.set_frame_on`
1368+
:meth:`matplotlib.axes.Axes.get_frame_on`
13631369
"""
13641370
ax = gca()
1365-
on = _string_to_bool(on)
13661371
if on is None:
13671372
on = not ax.get_frame_on()
1373+
on = _string_to_bool(on)
13681374
ax.set_frame_on(on)
13691375

13701376

‎lib/matplotlib/tests/test_pyplot.py

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from matplotlib import pyplot as plt
2+
3+
4+
def test_pyplot_box():
5+
fig, ax = plt.subplots()
6+
plt.box(False)
7+
assert not ax.get_frame_on()
8+
plt.box(True)
9+
assert ax.get_frame_on()
10+
plt.box()
11+
assert not ax.get_frame_on()
12+
plt.box()
13+
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.