8000 Remove the 'hold' kwarg from codebase · matplotlib/matplotlib@f81082a · GitHub
[go: up one dir, main page]

Skip to content

Commit f81082a

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

File tree

10 files changed

+97
-1068
lines changed

10 files changed

+97
-1068
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 123 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
@@ -34,10 +34,6 @@
3434

3535
rcParams = matplotlib.rcParams
3636

37-
_hold_msg = """axes.hold is deprecated.
38-
See the API Changes document (http://matplotlib.org/api/api_changes.html)
39-
for more details."""
40-
4137

4238
def _process_plot_format(fmt):
4339
"""
@@ -502,11 +498,6 @@ def __init__(self, fig, rect,
502498
self._axisbelow = rcParams['axes.axisbelow']
503499

504500
self._rasterization_zorder = None
505-
506-
self._hold = rcParams['axes.hold']
507-
if self._hold is None:
508-
self._hold = True
509-
510501
self._connected = {} # a dict from events to (id, func)
511502
self.cla()
512503

@@ -1231,49 +1222,6 @@ def set_color_cycle(self, clist):
12311222
else:
12321223
self.set_prop_cycle('color', clist)
12331224

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

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,9 @@ def _add_solids(self, X, Y, C):
647647
norm=self.norm,
648648
alpha=self.alpha,
649649
edgecolors='None')
650-
# Save, set, and restore hold state to keep pcolor from
651-
# clearing the axes. Ordinarily this will not be needed,
652-
# since the axes object should already have hold set.
653-
_hold = self.ax._hold
654-
self.ax._hold = True
655650
_log.debug('Setting pcolormesh')
656651
col = self.ax.pcolormesh(*args, **kw)
657-
self.ax._hold = _hold
658-
#self.add_observer(col) # We should observe, not be observed...
652+
# self.add_observer(col) # We should observe, not be observed...
659653

660654
if self.solids is not None:
661655
self.solids.remove()
@@ -1443,12 +1437,6 @@ def _add_solids(self, X, Y, C):
14431437
Draw the colors using :class:`~matplotlib.patches.Patch`;
14441438
optionally add separators.
14451439
"""
1446-
# Save, set, and restore hold state to keep pcolor from
1447-
# clearing the axes. Ordinarily this will not be needed,
1448-
# since the axes object should already have hold set.
1449-
_hold = self.ax._hold
1450-
self.ax._hold = True
1451-
14521440
kw = {'alpha': self.alpha, }
14531441

14541442
n_segments = len(C)
@@ -1494,8 +1482,6 @@ def _add_solids(self, X, Y, C):
14941482
linewidths=(0.5 * mpl.rcParams['axes.linewidth'],))
14951483
self.ax.add_collection(self.dividers)
14961484

1497-
self.ax._hold = _hold
1498-
14991485

15001486
def colorbar_factory(cax, mappable, **kwargs):
15011487
"""

lib/matplotlib/figure.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,6 @@ def __init__(self,
367367
self._set_artist_props(self.patch)
368368
self.patch.set_aa(False)
369369

370-
self._hold = rcParams['axes.hold']
371-
if self._hold is None:
372-
self._hold = True
373-
374370
self.canvas = None
375371
self._suptitle = None
376372

@@ -780,25 +776,6 @@ def set_canvas(self, canvas):
780776
"""
781777
self.canvas = canvas
782778

783-
@cbook.deprecated("2.0")
784-
def hold(self, b=None):
785-
"""
786-
Set the hold state. If hold is None (default), toggle the
787-
hold state. Else set the hold state to boolean value b.
788-
789-
e.g.::
790-
791-
hold() # toggle hold
792-
hold(True) # hold is on
793-
hold(False) # hold is off
794-
795-
All "hold" machinery is deprecated.
796-
"""
797-
if b is None:
798-
self._hold = not self._hold
799-
else:
800-
self._hold = b
801-
802779
def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None,
803780
vmin=None, vmax=None, origin=None, resize=False, **kwargs):
804781
"""
@@ -868,10 +845,6 @@ def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None,
868845
plt.show()
869846
870847
"""
871-
872-
if not self._hold:
873-
self.clf()
874-
875848
if resize:
876849
dpi = self.get_dpi()
877850
figsize = [x / dpi for x in (X.shape[1], X.shape[0])]
@@ -1922,7 +1895,6 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
19221895
cax, kw = cbar.make_axes_gridspec(ax, **kw)
19231896
else:
19241897
cax, kw = cbar.make_axes(ax, **kw)
1925-
cax._hold = True
19261898

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

0 commit comments

Comments
 (0)
0