Clear the Axes.
(self)
| 1327 | self.yaxis._scale = other.yaxis._scale |
| 1328 | |
| 1329 | def __clear(self): |
| 1330 | """Clear the Axes.""" |
| 1331 | # The actual implementation of clear() as long as clear() has to be |
| 1332 | # an adapter delegating to the correct implementation. |
| 1333 | # The implementation can move back into clear() when the |
| 1334 | # deprecation on cla() subclassing expires. |
| 1335 | |
| 1336 | # stash the current visibility state |
| 1337 | if hasattr(self, 'patch'): |
| 1338 | patch_visible = self.patch.get_visible() |
| 1339 | else: |
| 1340 | patch_visible = True |
| 1341 | |
| 1342 | xaxis_visible = self.xaxis.get_visible() |
| 1343 | yaxis_visible = self.yaxis.get_visible() |
| 1344 | |
| 1345 | for axis in self._axis_map.values(): |
| 1346 | axis.clear() # Also resets the scale to linear. |
| 1347 | for spine in self.spines.values(): |
| 1348 | spine._clear() # Use _clear to not clear Axis again |
| 1349 | |
| 1350 | self.ignore_existing_data_limits = True |
| 1351 | self.callbacks = cbook.CallbackRegistry( |
| 1352 | signals=["xlim_changed", "ylim_changed", "zlim_changed"]) |
| 1353 | |
| 1354 | # update the minor locator for x and y axis based on rcParams |
| 1355 | if mpl.rcParams['xtick.minor.visible']: |
| 1356 | self.xaxis.set_minor_locator(mticker.AutoMinorLocator()) |
| 1357 | if mpl.rcParams['ytick.minor.visible']: |
| 1358 | self.yaxis.set_minor_locator(mticker.AutoMinorLocator()) |
| 1359 | |
| 1360 | self._xmargin = mpl.rcParams['axes.xmargin'] |
| 1361 | self._ymargin = mpl.rcParams['axes.ymargin'] |
| 1362 | self._tight = None |
| 1363 | self._use_sticky_edges = True |
| 1364 | |
| 1365 | self._get_lines = _process_plot_var_args() |
| 1366 | self._get_patches_for_fill = _process_plot_var_args('Polygon') |
| 1367 | |
| 1368 | self._gridOn = mpl.rcParams['axes.grid'] |
| 1369 | # Swap children to minimize time we spend in an invalid state |
| 1370 | old_children, self._children = self._children, [] |
| 1371 | for chld in old_children: |
| 1372 | chld._remove_method = None |
| 1373 | chld._parent_figure = None |
| 1374 | chld.axes = None |
| 1375 | # Use list.clear to break the `artist._remove_method` reference cycle |
| 1376 | old_children.clear() |
| 1377 | self._mouseover_set = _OrderedSet() |
| 1378 | self.child_axes = [] |
| 1379 | self._current_image = None # strictly for pyplot via _sci, _gci |
| 1380 | self._projection_init = None # strictly for pyplot.subplot |
| 1381 | self.legend_ = None |
| 1382 | self.containers = [] |
| 1383 | |
| 1384 | self.grid(False) # Disable grid on init to use rcParameter |
| 1385 | self.grid(self._gridOn, which=mpl.rcParams['axes.grid.which'], |
| 1386 | axis=mpl.rcParams['axes.grid.axis']) |
no test coverage detected