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

Skip to content

Commit a11bf93

Browse files
committed
Remove the 'hold' kwarg from codebase
Fix data kwarg Fix contour boilerplating Remove last bits of _hold
1 parent 5d30d6a commit a11bf93

File tree

10 files changed

+97
-1069
lines changed

10 files changed

+97
-1069
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 124 deletions
Large diffs are not rendered by default.

lib/matplotlib/axes/_base.py

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@
4343
is_string_like = cbook.is_string_like
4444
is_sequence_of_strings = cbook.is_sequence_of_strings
4545

46-
_hold_msg = """axes.hold is deprecated.
47-
See the API Changes document (http://matplotlib.org/api/api_changes.html)
48-
for more details."""
49-
5046

5147
def _process_plot_format(fmt):
5248
"""
@@ -514,11 +510,6 @@ def __init__(self, fig, rect,
514510
self._axisbelow = rcParams['axes.axisbelow']
515511

516512
self._rasterization_zorder = None
517-
518-
self._hold = rcParams['axes.hold']
519-
if self._hold is None:
520-
self._hold = True
521-
522513
self._connected = {} # a dict from events to (id, func)
523514
self.cla()
524515

@@ -1241,49 +1232,6 @@ def set_color_cycle(self, clist):
12411232
else:
12421233
self.set_prop_cycle('color', clist)
12431234

1244-
@cbook.deprecated("2.0")
1245-
def ishold(self):
1246-
"""return the HOLD status of the axes
1247-
1248-
The `hold` mechanism is deprecated and will be removed in
1249-
v3.0.
1250-
"""
1251-
1252-
return self._hold
1253-
1254-
@cbook.deprecated("2.0", message=_hold_msg)
1255-
def hold(self, b=None):
1256-
"""
1257-
Set the hold state.
1258-
1259-
The ``hold`` mechanism is deprecated and will be removed in
1260-
v3.0. The behavior will remain consistent with the
1261-
long-time default value of True.
1262-
1263-
If *hold* is *None* (default), toggle the *hold* state. Else
1264-
set the *hold* state to boolean value *b*.
1265-
1266-
Examples::
1267-
1268-
# toggle hold
1269-
hold()
1270-
1271-
# turn hold on
1272-
hold(True)
1273-
1274-
# turn hold off
1275-
hold(False)
1276-
1277-
When hold is *True*, subsequent plot commands will be added to
1278-
the current axes. When hold is *False*, the current axes and
1279-
figure will be cleared on the next plot command
1280-
1281-
"""
1282-
if b is None:
1283-
self._hold = not self._hold
1284-
else:
1285-
self._hold = b
1286-
12871235
def get_aspect(self):
12881236
return self._aspect
12891237

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,8 @@ def _add_solids(self, X, Y, C):
515515
norm=self.norm,
516516
alpha=self.alpha,
517517
edgecolors='None')
518-
# Save, set, and restore hold state to keep pcolor from
519-
# clearing the axes. Ordinarily this will not be needed,
520-
# since the axes object should already have hold set.
521-
_hold = self.ax._hold
522-
self.ax._hold = True
523518
col = self.ax.pcolormesh(*args, **kw)
524-
self.ax._hold = _hold
525-
#self.add_observer(col) # We should observe, not be observed...
519+
# self.add_observer(col) # We should observe, not be observed...
526520

527521
if self.solids is not None:
528522
self.solids.remove()
@@ -1323,12 +1317,6 @@ def _add_solids(self, X, Y, C):
13231317
Draw the colors using :class:`~matplotlib.patches.Patch`;
13241318
optionally add separators.
13251319
"""
1326-
# Save, set, and restore hold state to keep pcolor from
1327-
# clearing the axes. Ordinarily this will not be needed,
1328-
# since the axes object should already have hold set.
1329-
_hold = self.ax._hold
1330-
self.ax._hold = True
1331-
13321320
kw = {'alpha': self.alpha, }
13331321

13341322
n_segments = len(C)
@@ -1374,8 +1362,6 @@ def _add_solids(self, X, Y, C):
13741362
linewidths=(0.5 * mpl.rcParams['axes.linewidth'],))
13751363
self.ax.add_collection(self.dividers)
13761364

1377-
self.ax._hold = _hold
1378-
13791365

13801366
def colorbar_factory(cax, mappable, **kwargs):
13811367
"""

lib/matplotlib/figure.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,6 @@ def __init__(self,
375375
self._set_artist_props(self.patch)
376376
self.patch.set_aa(False)
377377

378-
self._hold = rcParams['axes.hold']
379-
if self._hold is None:
380-
self._hold = True
381-
382378
self.canvas = None
383379
self._suptitle = None
384380

@@ -764,25 +760,6 @@ def set_canvas(self, canvas):
764760
"""
765761
self.canvas = canvas
766762

767-
@cbook.deprecated("2.0")
768-
def hold(self, b=None):
769-
"""
770-
Set the hold state. If hold is None (default), toggle the
771-
hold state. Else set the hold state to boolean value b.
772-
773-
e.g.::
774-
775-
hold() # toggle hold
776-
hold(True) # hold is on
777-
hold(False) # hold is off
778-
779-
All "hold" machinery is deprecated.
780-
"""
781-
if b is None:
782-
self._hold = not self._hold
783-
else:
784-
self._hold = b
785-
786763
def figimage(self, X,
787764
xo=0,
788765
yo=0,
@@ -849,10 +826,6 @@ def figimage(self, X,
849826
Additional kwargs are Artist kwargs passed on to
850827
:class:`~matplotlib.image.FigureImage`
851828
"""
852-
853-
if not self._hold:
854-
self.clf()
855-
856829
if resize:
857830
dpi = self.get_dpi()
858831
figsize = [x / dpi for x in (X.shape[1], X.shape[0])]
@@ -2060,7 +2033,6 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
20602033
cax, kw = cbar.make_axes_gridspec(ax, **kw)
20612034
else:
20622035
cax, kw = cbar.make_axes(ax, **kw)
2063-
cax._hold = True
20642036

20652037
# need to remove kws that cannot be passed to Colorbar
20662038
NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor',

0 commit comments

Comments
 (0)