Discussion:
[Matplotlib-users] pyplot functions: do you rely on the "hold" kwarg?
Eric Firing
2015-06-07 21:37:41 UTC
Permalink
Matplotlib's pyplot retains quite a few vestiges from its original
Matlab-workalike heritage; we would like to gradually eliminate those
that no longer make sense. One such candidate is the "hold" kwarg that
every pyplot function has, with a "True" default. I don't think it
serves any useful purpose now, and getting rid of it would allow
considerable simplification to the code and, to a lesser extent, the
documentation. The default behavior would not change, only the ability
to change that behavior via either the rcParams['axes.hold'] parameter
or the "hold" kwarg in a pyplot function call.

If you routinely use 'hold=False' and believe that removing it would be
a mistake, please let us know.

Thanks.

Eric

------------------------------------------------------------------------------
Eric Firing
2015-06-07 22:17:55 UTC
Permalink
Post by Eric Firing
Matplotlib's pyplot retains quite a few vestiges from its original
Matlab-workalike heritage; we would like to gradually eliminate those
that no longer make sense. One such candidate is the "hold" kwarg that
every pyplot function has, with a "True" default. I don't think it
serves any useful purpose now, and getting rid of it would allow
considerable simplification to the code and, to a lesser extent, the
documentation. The default behavior would not change, only the ability
to change that behavior via either the rcParams['axes.hold'] parameter
or the "hold" kwarg in a pyplot function call.
If you routinely use 'hold=False' and believe that removing it would be
a mistake, please let us know.
I do actually use it with some regularity interactively, though I'm
not particularly attached to it. Is there some equivalent though, like
plt.whatever(..., hold=False)
can become
plt.clear(); plt.whatever(...)
It's exactly equivalent to:
plt.cla(); plt.whatever(...)
? The semantics would be that the current figure remains the current
figure, but is reset so that the next operation starts from scratch. I
notice that plt.clear() does not exist, but maybe it has another
spelling :-).
There are two types of "clear":
plt.clf() # clear the current Figure
plt.cla() # clear the current Axes

Eric
(Basically the use case here is getting something like the
edit-and-rerun-a-cell workflow, but when using a classic interactive
REPL rather than the ipython notebook -- so I have a specific plot
window up on my screen at a size and place where I can see it, and
maybe some other plots in other windows in the background somewhere,
and I want to quickly display different things into that window.)
-n
------------------------------------------------------------------------------
Loading...