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

Skip to content

Commit 621b98c

Browse files
committed
DOC: update plt.draw docstring
1 parent db31e6c commit 621b98c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/matplotlib/pyplot.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -666,24 +666,18 @@ def clf():
666666

667667

668668
def draw():
669-
"""
670-
Redraw the current figure.
669+
"""Redraw the current figure.
671670
672-
This is used in interactive mode to update a figure that
673-
has been altered using one or more plot object method calls;
674-
it is not needed if figure modification is done entirely
675-
with pyplot functions, if a sequence of modifications ends
676-
with a pyplot function, or if matplotlib is in non-interactive
677-
mode and the sequence of modifications ends with :func:`show` or
678-
:func:`savefig`.
671+
This is used in interactive mode to update a figure that has been
672+
altered, but not automatically re-drawn. This should be only rarely
673+
needed, but there may be ways to modify the state of a figure with
674+
out marking it as `stale`. Please report these cases as bugs.
679675
680676
A more object-oriented alternative, given any
681677
:class:`~matplotlib.figure.Figure` instance, :attr:`fig`, that
682678
was created using a :mod:`~matplotlib.pyplot` function, is::
683679
684680
fig.canvas.draw_idle()
685-
686-
687681
"""
688682
get_current_fig_manager().canvas.draw_idle()
689683

@@ -692,7 +686,7 @@ def draw():
692686
def savefig(*args, **kwargs):
693687
fig = gcf()
694688
res = fig.savefig(*args, **kwargs)
695-
draw() # need this if 'transparent=True' to reset colors
689+
fig.canvas.draw_idle() # need this if 'transparent=True' to reset colors
696690
return res
697691

698692

0 commit comments

Comments
 (0)