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