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

Skip to content

Commit 16bcbdf

Browse files
committed
DOC : add whats new entry
1 parent 9706cc0 commit 16bcbdf

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Interactive OO usage
2+
--------------------
3+
4+
All `Artists` now keep track of if their internal state has been
5+
changed but not reflected in the display ('stale') by a call to
6+
``draw``. It is thus possible to pragmatically determine if a given
7+
`Figure` needs to be re-drawn in an interactive session.
8+
9+
To facilitate interactive usage a ``draw_all`` method has been added
10+
to ``pyplot`` which will redraw all of the figures which are 'stale'.
11+
12+
To make this convenient for interactive use matplotlib now registers
13+
a function either with IPython's 'post_execute' event or with the
14+
displayhook in the standard python REPL to automatically call
15+
``plt.draw_all`` just before control is returned to the REPL. This ensures
16+
that the draw command is deferred and only called once.
17+
18+
The upshot of this is that for interactive backends (including notebook)
19+
20+
.. ipython :: python
21+
22+
import matplotlib.pyplot as plt
23+
24+
fig, ax = plt.subplots()
25+
26+
ln, = ax.plot([0, 1, 4, 9, 16])
27+
28+
plt.show()
29+
30+
ln.set_color('g')
31+
32+
33+
will automatically update the plot to be green. Subsequent
34+
modifications to the `Artist` objects will do likewise.
35+
36+
This is the first step of a larger consolidation and simplification of
37+
the pyplot internals.

0 commit comments

Comments
 (0)