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

Skip to content

Commit dce381e

Browse files
committed
DOC: add entry to api_changes; improve some docstrings
1 parent 785a516 commit dce381e

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

doc/api/api_changes.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Color of Axes
2222
The ``axisbg`` and ``axis_bgcolor`` properties on ``Axes`` have been
2323
deprecated in favor of ``facecolor``.
2424

25-
2625
GTK and GDK backends deprecated
2726
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2827
The GDK and GTK backends have been deprecated. These obsolete backends
@@ -41,6 +40,16 @@ CocoaAgg backend removed
4140
~~~~~~~~~~~~~~~~~~~~~~~~
4241
The deprecated and not fully functional CocoaAgg backend has been removed.
4342

43+
'hold' functionality deprecated
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
The 'hold' keyword argument and all functions and methods related
46+
to it are deprecated, along with the 'axes.hold' `rcParams` entry.
47+
The behavior will remain consistent with the default ``hold=True``
48+
state that has long been in place. Instead of using a function
49+
or keyword argument (``hold=False``) to change that behavior,
50+
explicitly clear the axes or figure as needed prior to subsequent
51+
plotting commands.
52+
4453

4554
`Artist.update` has return value
4655
--------------------------------

lib/matplotlib/pyplot.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,11 @@ def figlegend(handles, labels, loc, **kwargs):
776776

777777
## Figure and Axes hybrid ##
778778

779-
@deprecated("2.0")
779+
_hold_msg = """Future behavior will be consistent with the long-time
780+
default: plot commands add elements without first
781+
clearing the Axes and/or Figure."""
782+
783+
@deprecated("2.0", message=_hold_msg)
780784
def hold(b=None):
781785
"""
782786
Set the hold state. If *b* is None (default), toggle the
@@ -786,12 +790,10 @@ def hold(b=None):
786790
hold(True) # hold is on
787791
hold(False) # hold is off
788792
789-
When *hold* is *True*, subsequent plot commands will be added to
793+
When *hold* is *True*, subsequent plot commands will add elements to
790794
the current axes. When *hold* is *False*, the current axes and
791795
figure will be cleared on the next plot command.
792796
793-
Deprecated. Future behavior will be consistent with the
794-
long-time default of True.
795797
"""
796798

797799
fig = gcf()
@@ -812,17 +814,16 @@ def hold(b=None):
812814
# a second warning, but "Oh, well...".
813815
rc('axes', hold=b)
814816

815-
@deprecated("2.0")
817+
@deprecated("2.0", message=_hold_msg)
816818
def ishold():
817819
"""
818820
Return the hold status of the current axes.
819821
820-
Deprecated.
821822
"""
822823
return gca()._hold
823824

824825

825-
@deprecated("2.0")
826+
@deprecated("2.0", message=_hold_msg)
826827
def over(func, *args, **kwargs):
827828
"""
828829
Call a function with hold(True).
@@ -833,7 +834,6 @@ def over(func, *args, **kwargs):
833834
834835
with ``hold(True)`` and then restores the hold state.
835836
836-
Deprecated.
837837
"""
838838
ax = gca()
839839
h = ax._hold

0 commit comments

Comments
 (0)