Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1cbc34a

Browse files
committed
MNT/DOC: remove all usage of Figure.clf from codebase
1 parent 6b7c237 commit 1cbc34a

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

doc/api/prev_api_changes/api_changes_3.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ Hold machinery
471471
Setting or unsetting ``hold`` (:ref:`deprecated in version 2.0<v200_deprecate_hold>`) has now
472472
been completely removed. Matplotlib now always behaves as if ``hold=True``.
473473
To clear an axes you can manually use :meth:`~.axes.Axes.cla()`,
474-
or to clear an entire figure use :meth:`~.figure.Figure.clf()`.
474+
or to clear an entire figure use :meth:`~.figure.Figure.clear()`.
475475

476476

477477
Removal of deprecated backends

doc/users/prev_whats_new/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3139,7 +3139,7 @@ the `API changes <../../api/api_changes.html>`_.
31393139
Fixed a bug in backend_qt4, reported on mpl-dev - DSD
31403140

31413141
2007-03-26
3142-
Removed colorbar_classic from figure.py; fixed bug in Figure.clf() in which
3142+
Removed colorbar_classic from figure.py; fixed bug in Figure.clear() in which
31433143
_axobservers was not getting cleared. Modernization and cleanups. - EF
31443144

31453145
2007-03-26

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ def close(fig=None):
953953

954954
def clf():
955955
"""Clear the current figure."""
956-
gcf().clf()
956+
gcf().clear()
957957

958958

959959
def draw():

lib/matplotlib/tests/test_usetex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_minus_no_descent(fontsize):
7474
heights = {}
7575
fig = plt.figure()
7676
for vals in [(1,), (-1,), (-1, 1)]:
77-
fig.clf()
77+
fig.clear()
7878
for x in vals:
7979
fig.text(.5, .5, f"${x}$", usetex=True)
8080
fig.canvas.draw()

0 commit comments

Comments
 (0)