@@ -36,11 +36,16 @@ that include interactive tools, a toolbar, a tool-tip, and
36
36
`.pyplot.subplots `
37
37
Creates a new `.Figure ` and fills it with a grid of `~.axes.Axes `
38
38
39
- `.pyplot ` has a notion of "The Current Figure" which can be accessed
40
- through `.pyplot.gcf ` and a notion of "The Current Axes" accessed
41
- through `.pyplot.gca `. Almost all of the functions in `.pyplot ` pass
42
- through the current `.Figure ` / `~.axes.Axes ` (or create one) as
43
- appropriate.
39
+ `.pyplot.gcf `
40
+ Get the current `.Figure `. If there is current no figure on the pyplot figure
41
+ stack, a new figure is created
42
+
43
+ `.pyplot.gca `
44
+ Get the current `~.axes.Axes `. If there is current no Axes on the Figure,
45
+ a new one is created
46
+
47
+ Almost all of the functions in `.pyplot ` pass through the current `.Figure ` / `~.axes.Axes `
48
+ (or create one) as appropriate.
44
49
45
50
Matplotlib keeps a reference to all of the open figures
46
51
created via `pyplot.figure ` or `pyplot.subplots ` so that the figures will not be garbage
@@ -51,7 +56,6 @@ collected. `.Figure`\s can be closed and deregistered from `.pyplot` individuall
51
56
.. seealso ::
52
57
53
58
For more discussion of Matplotlib's event system and integrated event loops:
54
-
55
59
- :ref: `interactive_figures_and_eventloops `
56
60
- :ref: `event-handling `
57
61
@@ -189,7 +193,7 @@ the GUI main loop in some other way.
189
193
190
194
.. warning ::
191
195
192
- Using `.Figure.show ` it is possible to display a figure on
196
+ Using `.Figure.show `, it is possible to display a figure on
193
197
the screen without starting the event loop and without being in
194
198
interactive mode. This may work (depending on the GUI toolkit) but
195
199
will likely result in a non-responsive figure.
@@ -211,8 +215,7 @@ Interactive navigation
211
215
.. image :: ../../../_static/toolbar.png
212
216
213
217
All figure windows come with a navigation toolbar, which can be used
214
- to navigate through the data set. Here is a description of each of
215
- the buttons at the bottom of the toolbar
218
+ to navigate through the data set.
216
219
217
220
.. image :: ../../../../lib/matplotlib/mpl-data/images/home_large.png
218
221
@@ -221,20 +224,19 @@ the buttons at the bottom of the toolbar
221
224
.. image :: ../../../../lib/matplotlib/mpl-data/images/forward_large.png
222
225
223
226
The ``Home ``, ``Forward `` and ``Back `` buttons
224
- These are akin to a web browser's home, forward and back controls.
227
+ These are similar to a web browser's home, forward and back controls.
225
228
``Forward `` and ``Back `` are used to navigate back and forth between
226
229
previously defined views. They have no meaning unless you have already
227
230
navigated somewhere else using the pan and zoom buttons. This is analogous
228
231
to trying to click ``Back `` on your web browser before visiting a
229
232
new page or ``Forward `` before you have gone back to a page --
230
- nothing happens. ``Home `` always takes you to the
231
- first, default view of your data. Again, all of these buttons should
232
- feel very familiar to any user of a web browser.
233
+ nothing happens. ``Home `` takes you to the
234
+ first, default view of your data.
233
235
234
236
.. image :: ../../../../lib/matplotlib/mpl-data/images/move_large.png
235
237
236
238
The ``Pan/Zoom `` button
237
- This button has two modes: pan and zoom. Click the toolbar button
239
+ This button has two modes: pan and zoom. Click the `` Pan/Zoom `` button
238
240
to activate panning and zooming, then put your mouse somewhere
239
241
over an axes. Press the left mouse button and hold it to pan the
240
242
figure, dragging it to a new position. When you release it, the
@@ -244,8 +246,8 @@ The ``Pan/Zoom`` button
244
246
the right mouse button to zoom, dragging it to a new position.
245
247
The x axis will be zoomed in proportionately to the rightward
246
248
movement and zoomed out proportionately to the leftward movement.
247
- The same is true for the y axis and up/down motions. The point under your
248
- mouse when you begin the zoom remains stationary, allowing you to
249
+ The same is true for the y axis and up/down motions (up zooms in, down zooms out).
250
+ The point under your mouse when you begin the zoom remains stationary, allowing you to
249
251
zoom in or out around that point as much as you wish. You can use the
250
252
modifier keys 'x', 'y' or 'CONTROL' to constrain the zoom to the x
251
253
axis, the y axis, or aspect ratio preserve, respectively.
@@ -257,9 +259,8 @@ The ``Pan/Zoom`` button
257
259
258
260
.. image :: ../../../../lib/matplotlib/mpl-data/images/zoom_to_rect_large.png
259
261
260
- The ``Zoom-to-rectangle `` button
261
- Click this toolbar button to activate this mode. Put your mouse somewhere
262
- over an axes and press a mouse button. Define a rectangular region by
262
+ The ``Zoom-to-Rectangle `` button
263
+ Put your mouse somewhere over an axes and press a mouse button. Define a rectangular region by
263
264
dragging the mouse while holding the button to a new location. When using
264
265
the left mouse button, the axes view limits will be zoomed to the defined
265
266
region. When using the right mouse button, the axes view limits will be
@@ -268,8 +269,8 @@ The ``Zoom-to-rectangle`` button
268
269
.. image :: ../../../../lib/matplotlib/mpl-data/images/subplots_large.png
269
270
270
271
The ``Subplot-configuration `` button
271
- Use this tool to configure the appearance of the subplot:
272
- you can stretch or compress the left, right, top, or bottom
272
+ Use this button to configure the appearance of the subplot.
273
+ You can stretch or compress the left, right, top, or bottom
273
274
side of the subplot, or the space between the rows or
274
275
space between the columns.
275
276
@@ -325,7 +326,7 @@ Interactive mode works in the default Python prompt:
325
326
>>> plt.ion()
326
327
>>>
327
328
328
- however this does not ensure that the event hook is properly installed
329
+ However, this does not ensure that the event hook is properly installed
329
330
and your figures may not be responsive. Please consult the
330
331
documentation of your GUI toolkit for details.
331
332
@@ -335,16 +336,6 @@ documentation of your GUI toolkit for details.
335
336
Jupyter Notebooks / JupyterLab
336
337
------------------------------
337
338
338
- .. note ::
339
-
340
- To get the interactive functionality described here, you must be
341
- using an interactive backend. The default backend in notebooks,
342
- the inline backend, is not. `~ipykernel.pylab.backend_inline `
343
- renders the figure once and inserts a static image into the
344
- notebook when the cell is executed. Because the images are static, they
345
- cannot be panned / zoomed, take user input, or be updated from other
346
- cells.
347
-
348
339
To get interactive figures in the 'classic' notebook or Jupyter lab,
349
340
use the `ipympl <https://matplotlib.org/ipympl >`__ backend
350
341
(must be installed separately) which uses the **ipywidget ** framework.
@@ -356,7 +347,7 @@ If ``ipympl`` is installed use the magic:
356
347
357
348
to select and enable it.
358
349
359
- If you only need to use the classic notebook, you can use
350
+ If you only need to use the classic notebook (i.e. `` notebook<7 ``) , you can use
360
351
361
352
.. sourcecode :: ipython
362
353
@@ -365,6 +356,16 @@ If you only need to use the classic notebook, you can use
365
356
which uses the `.backend_nbagg ` backend provided by Matplotlib;
366
357
however, nbagg does not work in Jupyter Lab.
367
358
359
+ .. note ::
360
+
361
+ To get the interactive functionality described here, you must be
362
+ using an interactive backend. The default backend in notebooks,
363
+ the inline backend, is not. `~ipykernel.pylab.backend_inline `
364
+ renders the figure once and inserts a static image into the
365
+ notebook when the cell is executed. Because the images are static, they
366
+ cannot be panned / zoomed, take user input, or be updated from other
367
+ cells.
368
+
368
369
GUIs + Jupyter
369
370
^^^^^^^^^^^^^^
370
371
0 commit comments