@@ -485,39 +485,26 @@ interface window, you do not need to call ``show`` (see :ref:`howto-batch`
485
485
and :ref: `what-is-a-backend `).
486
486
487
487
.. note ::
488
- Because closing a figure window invokes the destruction of its plotting
489
- elements, you should call :func: `~matplotlib.pyplot.savefig ` *before *
490
- calling `` show `` if you wish to save the figure as well as view it.
488
+ Because closing a figure window unregisters it from pyplot, you must call
489
+ `~matplotlib.pyplot.savefig ` *before * calling `` show `` if you wish to save
490
+ the figure as well as view it.
491
491
492
- .. versionadded :: v1.0.0
493
- ``show `` now starts the GUI mainloop only if it isn't already running.
494
- Therefore, multiple calls to ``show `` are now allowed.
495
-
496
- Having ``show `` block further execution of the script or the python
497
- interpreter depends on whether Matplotlib is set for interactive mode
498
- or not. In non-interactive mode (the default setting), execution is paused
492
+ Whether ``show `` blocks further execution of the script or the python
493
+ interpreter depends on whether Matplotlib is set to use interactive mode.
494
+ In non-interactive mode (the default setting), execution is paused
499
495
until the last figure window is closed. In interactive mode, the execution
500
496
is not paused, which allows you to create additional figures (but the script
501
497
won't finish until the last figure window is closed).
502
498
503
- .. note ::
504
- Support for interactive/non-interactive mode depends upon the backend.
505
- Until version 1.0.0 (and subsequent fixes for 1.0.1), the behavior of
506
- the interactive mode was not consistent across backends.
507
- As of v1.0.1, only the macosx backend differs from other backends
508
- because it does not support non-interactive mode.
509
-
510
-
511
499
Because it is expensive to draw, you typically will not want Matplotlib
512
500
to redraw a figure many times in a script such as the following::
513
501
514
- plot([1,2, 3]) # draw here ?
515
- xlabel('time') # and here ?
516
- ylabel('volts') # and here ?
517
- title('a simple plot') # and here ?
502
+ plot([1, 2, 3]) # draw here?
503
+ xlabel('time') # and here?
504
+ ylabel('volts') # and here?
505
+ title('a simple plot') # and here?
518
506
show()
519
507
520
-
521
508
However, it is *possible * to force Matplotlib to draw after every command,
522
509
which might be what you want when working interactively at the
523
510
python console (see :ref: `mpl-shell `), but in a script you want to
@@ -534,26 +521,10 @@ you're all done issuing commands and you want to draw the figure now.
534
521
If you want to force a figure draw, use
535
522
:func: `~matplotlib.pyplot.draw ` instead.
536
523
537
- Many users are frustrated by ``show `` because they want it to be a
538
- blocking call that raises the figure, pauses the script until they
539
- close the figure, and then allow the script to continue running until
540
- the next figure is created and the next show is made. Something like
541
- this::
542
-
543
- # WARNING : illustrating how NOT to use show
544
- for i in range(10):
545
- # make figure i
546
- show()
547
-
548
- This is not what show does and unfortunately, because doing blocking
549
- calls across user interfaces can be tricky, is currently unsupported,
550
- though we have made significant progress towards supporting blocking events.
551
-
552
524
.. versionadded :: v1.0.0
553
- As noted earlier, this restriction has been relaxed to allow multiple
554
- calls to ``show ``. In *most * backends, you can now expect to be
555
- able to create new figures and raise them in a subsequent call to
556
- ``show `` after closing the figures from a previous call to ``show ``.
525
+ Matplotlib 1.0.0 and 1.0.1 added support for calling ``show `` multiple times
526
+ per script, and harmonized the behavior of interactive mode, across most
527
+ backends.
557
528
558
529
.. _howto-boxplot_violinplot :
559
530
0 commit comments