Skip to content

Commit ac7f86b

Browse files
committed
Close all plot windows of a blocking show() on Ctrl+C
Addresses the Qt part of #23385. It appears that `qapp.quit()` does not automatically close the windows of the app. We therefore do it explicitly. A unit test for this would be quite complex. Test this by hand by Ctrl+C in an interactive shell.
1 parent 6501209 commit ac7f86b

File tree

63 files changed

+122
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+122
-102
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{ fullname | escape | underline }}
2+
3+
4+
.. currentmodule:: {{ module }}
5+
6+
7+
{% if objtype in ['class'] %}
8+
9+
.. auto{{ objtype }}:: {{ objname }}
10+
:no-members:
11+
:no-index:
12+
13+
{% endif %}

doc/api/figure_api.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010

1111
The Figure class
1212
================
13+
.. class:: Figure
14+
15+
Creation
16+
--------
17+
1318
.. autosummary::
1419
:toctree: _as_gen
15-
:template: autosummary_class_only.rst
20+
:template: autosummary_class_only_noindex.rst
1621
:nosignatures:
1722

1823
Figure

galleries/examples/animation/multiple_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
=======================
3-
Multiple axes animation
3+
Multiple Axes animation
44
=======================
55
66
This example showcases:

galleries/examples/axes_grid1/demo_axes_divider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Axes divider
44
============
55
6-
Axes divider to calculate location of axes and
7-
create a divider for them using existing axes instances.
6+
Axes divider to calculate location of Axes and
7+
create a divider for them using existing Axes instances.
88
"""
99

1010
import matplotlib.pyplot as plt

galleries/examples/axes_grid1/demo_axes_grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Demo Axes Grid
44
==============
55
6-
Grid of 2x2 images with a single colorbar or with one colorbar per axes.
6+
Grid of 2x2 images with a single colorbar or with one colorbar per Axes.
77
"""
88

99
import matplotlib.pyplot as plt

galleries/examples/axes_grid1/demo_axes_hbox_divider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Using an `.HBoxDivider` to arrange subplots.
77
8-
Note that both axes' location are adjusted so that they have
8+
Note that both Axes' location are adjusted so that they have
99
equal heights while maintaining their aspect ratios.
1010
1111
"""

galleries/examples/axes_grid1/demo_colorbar_of_inset_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
===============================
3-
Adding a colorbar to inset axes
3+
Adding a colorbar to inset Axes
44
===============================
55
"""
66

galleries/examples/axes_grid1/demo_colorbar_with_axes_divider.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
Colorbar with AxesDivider
66
=========================
77
8-
The `.axes_divider.make_axes_locatable` function takes an existing axes, adds
8+
The `.axes_divider.make_axes_locatable` function takes an existing Axes, adds
99
it to a new `.AxesDivider` and returns the `.AxesDivider`. The `.append_axes`
10-
method of the `.AxesDivider` can then be used to create a new axes on a given
11-
side ("top", "right", "bottom", or "left") of the original axes. This example
12-
uses `.append_axes` to add colorbars next to axes.
10+
method of the `.AxesDivider` can then be used to create a new Axes on a given
11+
side ("top", "right", "bottom", or "left") of the original Axes. This example
12+
uses `.append_axes` to add colorbars next to Axes.
1313
14-
Users should consider simply passing the main axes to the *ax* keyword argument of
15-
`~.Figure.colorbar` instead of creating a locatable axes manually like this.
14+
Users should consider simply passing the main Axes to the *ax* keyword argument of
15+
`~.Figure.colorbar` instead of creating a locatable Axes manually like this.
1616
See :ref:`colorbar_placement`.
1717
"""
1818

galleries/examples/axes_grid1/demo_colorbar_with_inset_locator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This example shows how to control the position, height, and width of colorbars
99
using `~mpl_toolkits.axes_grid1.inset_locator.inset_axes`.
1010
11-
Inset axes placement is controlled as for legends: either by providing a *loc*
11+
Inset Axes placement is controlled as for legends: either by providing a *loc*
1212
option ("upper right", "best", ...), or by providing a locator with respect to
1313
the parent bbox. Parameters such as *bbox_to_anchor* and *borderpad* likewise
1414
work in the same way, and are also demonstrated here.

galleries/examples/axes_grid1/scatter_hist_locatable_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
Show the marginal distributions of a scatter plot as histograms at the sides of
77
the plot.
88
9-
For a nice alignment of the main axes with the marginals, the axes positions
9+
For a nice alignment of the main Axes with the marginals, the Axes positions
1010
are defined by a ``Divider``, produced via `.make_axes_locatable`. Note that
11-
the ``Divider`` API allows setting axes sizes and pads in inches, which is its
11+
the ``Divider`` API allows setting Axes sizes and pads in inches, which is its
1212
main feature.
1313
14-
If one wants to set axes sizes and pads relative to the main Figure, see the
14+
If one wants to set Axes sizes and pads relative to the main Figure, see the
1515
:doc:`/gallery/lines_bars_and_markers/scatter_hist` example.
1616
"""
1717

galleries/examples/axisartist/demo_curvelinear_grid2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
This example demonstrates how to use GridHelperCurveLinear to define
99
custom grids and ticklines by applying a transformation on the grid.
10-
As showcase on the plot, a 5x5 matrix is displayed on the axes.
10+
As showcase on the plot, a 5x5 matrix is displayed on the Axes.
1111
"""
1212

1313
import matplotlib.pyplot as plt

galleries/examples/axisartist/demo_parasite_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Parasite Axes demo
44
==================
55
6-
Create a parasite axes. Such axes would share the x scale with a host axes,
6+
Create a parasite Axes. Such Axes would share the x scale with a host Axes,
77
but show a different scale in y direction.
88
99
This approach uses `mpl_toolkits.axes_grid1.parasite_axes.HostAxes` and

galleries/examples/color/colorbar_basics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Use `~.Figure.colorbar` by specifying the mappable object (here
77
the `.AxesImage` returned by `~.axes.Axes.imshow`)
8-
and the axes to attach the colorbar to.
8+
and the Axes to attach the colorbar to.
99
"""
1010

1111
import matplotlib.pyplot as plt

galleries/examples/event_handling/data_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class PointBrowser:
2424
"""
2525
Click on a point to select and highlight it -- the data that
26-
generated the point will be shown in the lower axes. Use the 'n'
26+
generated the point will be shown in the lower Axes. Use the 'n'
2727
and 'p' keys to browse through the next and previous points
2828
"""
2929

galleries/examples/images_contours_and_fields/image_annotated_heatmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def heatmap(data, row_labels, col_labels, ax=None,
114114
A list or array of length N with the labels for the columns.
115115
ax
116116
A `matplotlib.axes.Axes` instance to which the heatmap is plotted. If
117-
not provided, use current axes or create a new one. Optional.
117+
not provided, use current Axes or create a new one. Optional.
118118
cbar_kw
119119
A dictionary with arguments to `matplotlib.Figure.colorbar`. Optional.
120120
cbarlabel

galleries/examples/lines_bars_and_markers/eventcollection_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
====================
55
66
Plot two curves, then use `.EventCollection`\s to mark the locations of the x
7-
and y data points on the respective axes for each curve.
7+
and y data points on the respective Axes for each curve.
88
"""
99

1010
import matplotlib.pyplot as plt

galleries/examples/lines_bars_and_markers/filled_step.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def filled_hist(ax, edges, values, bottoms=None, orientation='v',
2525
Parameters
2626
----------
2727
ax : Axes
28-
The axes to plot to
28+
The Axes to plot to.
2929
3030
edges : array
3131
A length n+1 array giving the left edges of each bin and the
@@ -85,7 +85,7 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None,
8585
Parameters
8686
----------
8787
ax : axes.Axes
88-
The axes to add artists too
88+
The Axes to add artists to.
8989
9090
stacked_data : array or Mapping
9191
A (M, N) shaped array. The first dimension will be iterated over to

galleries/examples/lines_bars_and_markers/gradient_bar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def gradient_image(ax, direction=0.3, cmap_range=(0, 1), **kwargs):
3030
Parameters
3131
----------
3232
ax : Axes
33-
The axes to draw on.
33+
The Axes to draw on.
3434
direction : float
3535
The direction of the gradient. This is a number in
3636
range 0 (=vertical) to 1 (=horizontal).

galleries/examples/lines_bars_and_markers/scatter_hist.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
Show the marginal distributions of a scatter plot as histograms at the sides of
77
the plot.
88
9-
For a nice alignment of the main axes with the marginals, two options are shown
9+
For a nice alignment of the main Axes with the marginals, two options are shown
1010
below:
1111
1212
.. contents::
1313
:local:
1414
1515
While `.Axes.inset_axes` may be a bit more complex, it allows correct handling
16-
of main axes with a fixed aspect ratio.
16+
of main Axes with a fixed aspect ratio.
1717
1818
An alternative method to produce a similar figure using the ``axes_grid1``
1919
toolkit is shown in the :doc:`/gallery/axes_grid1/scatter_hist_locatable_axes`
20-
example. Finally, it is also possible to position all axes in absolute
20+
example. Finally, it is also possible to position all Axes in absolute
2121
coordinates using `.Figure.add_axes` (not shown here).
2222
2323
Let us first define a function that takes x and y data as input, as well
24-
as three axes, the main axes for the scatter, and two marginal axes. It will
25-
then create the scatter and histograms inside the provided axes.
24+
as three Axes, the main Axes for the scatter, and two marginal Axes. It will
25+
then create the scatter and histograms inside the provided Axes.
2626
"""
2727

2828
import matplotlib.pyplot as plt

galleries/examples/misc/coords_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Coords Report
44
=============
55
6-
Override the default reporting of coords as the mouse moves over the axes
6+
Override the default reporting of coords as the mouse moves over the Axes
77
in an interactive backend.
88
"""
99

galleries/examples/misc/fig_x.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Adding lines to figures
44
=======================
55
6-
Adding lines to a figure without any axes.
6+
Adding lines to a figure without any Axes.
77
88
.. redirect-from:: /gallery/pyplots/fig_x
99
"""

galleries/examples/misc/logos2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_font_properties():
3636

3737
def create_icon_axes(fig, ax_position, lw_bars, lw_grid, lw_border, rgrid):
3838
"""
39-
Create a polar axes containing the matplotlib radar plot.
39+
Create a polar Axes containing the matplotlib radar plot.
4040
4141
Parameters
4242
----------

galleries/examples/misc/rasterization_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
Whether rasterization should be used can be specified per artist. This can be
1111
useful to reduce the file size of large artists, while maintaining the
12-
advantages of vector graphics for other artists such as the axes
12+
advantages of vector graphics for other artists such as the Axes
1313
and text. For instance a complicated `~.Axes.pcolormesh` or
1414
`~.Axes.contourf` can be made significantly simpler by rasterizing.
1515
Setting rasterization only affects vector backends such as PDF, SVG, or PS.

galleries/examples/mplot3d/mixed_subplots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
=============================
3-
2D and 3D axes in same figure
3+
2D and 3D Axes in same figure
44
=============================
55
66
This example shows a how to plot a 2D and a 3D plot on the same figure.

galleries/examples/mplot3d/pathpatch3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs):
1919
"""
20-
Plots the string *s* on the axes *ax*, with position *xyz*, size *size*,
20+
Plots the string *s* on the Axes *ax*, with position *xyz*, size *size*,
2121
and rotation angle *angle*. *zdir* gives the axis which is to be treated as
2222
the third dimension. *usetex* is a boolean indicating whether the string
2323
should be run through a LaTeX subprocess or not. Any additional keyword

galleries/examples/pie_and_polar_charts/bar_of_pie.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Make a "bar of pie" chart where the first slice of the pie is
77
"exploded" into a bar chart with a further breakdown of said slice's
88
characteristics. The example demonstrates using a figure with multiple
9-
sets of axes and using the axes patches list to add two ConnectionPatches
9+
sets of Axes and using the axes patches list to add two ConnectionPatches
1010
to link the subplot charts.
1111
"""
1212

galleries/examples/pyplots/pyplot_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Set the special text objects `~.pyplot.title`, `~.pyplot.xlabel`, and
77
`~.pyplot.ylabel` through the dedicated pyplot functions. Additional text
8-
objects can be placed in the axes using `~.pyplot.text`.
8+
objects can be placed in the Axes using `~.pyplot.text`.
99
1010
You can use TeX-like mathematical typesetting in all texts; see also
1111
:ref:`mathtext`.

galleries/examples/shapes_and_collections/patch_collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
This example demonstrates how to use `.collections.PatchCollection`.
77
88
See also :doc:`/gallery/shapes_and_collections/artist_reference`, which instead
9-
adds each artist separately to its own axes.
9+
adds each artist separately to its own Axes.
1010
"""
1111

1212
import matplotlib.pyplot as plt

galleries/examples/specialty_plots/leftventricle_bullseye.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap="viridis", norm=None):
2323
2424
Parameters
2525
----------
26-
ax : axes
26+
ax : Axes
2727
data : list[float]
2828
The intensity values for each of the 17 segments.
2929
seg_bold : list[int], optional

galleries/examples/specialty_plots/radar_chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def radar_factory(num_vars, frame='circle'):
3636
num_vars : int
3737
Number of variables for radar chart.
3838
frame : {'circle', 'polygon'}
39-
Shape of frame surrounding axes.
39+
Shape of frame surrounding Axes.
4040
4141
"""
4242
# calculate evenly-spaced axis angles

galleries/examples/spines/multiple_yaxis_with_spines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
===========================
55
66
Create multiple y axes with a shared x-axis. This is done by creating
7-
a `~.axes.Axes.twinx` axes, turning all spines but the right one invisible
7+
a `~.axes.Axes.twinx` Axes, turning all spines but the right one invisible
88
and offset its position using `~.spines.Spine.set_position`.
99
1010
Note that this approach uses `matplotlib.axes.Axes` and their
11-
`~matplotlib.spines.Spine`\s. Alternative approaches using non-standard axes
11+
`~matplotlib.spines.Spine`\s. Alternative approaches using non-standard Axes
1212
are shown in the :doc:`/gallery/axisartist/demo_parasite_axes` and
1313
:doc:`/gallery/axisartist/demo_parasite_axes2` examples.
1414
"""

galleries/examples/spines/spines_dropped.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dropped spines
44
==============
55
6-
Demo of spines offset from the axes (a.k.a. "dropped spines").
6+
Demo of spines offset from the Axes (a.k.a. "dropped spines").
77
"""
88
import matplotlib.pyplot as plt
99
import numpy as np

galleries/examples/statistics/boxplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
individual components (note that the mean is the only value not shown by
99
default). The second figure demonstrates how the styles of the artists can be
1010
customized. It also demonstrates how to set the limit of the whiskers to
11-
specific percentiles (lower right axes)
11+
specific percentiles (lower right Axes)
1212
1313
A good general reference on boxplots and their history can be found here:
1414
https://vita.had.co.nz/papers/boxplots.pdf

galleries/examples/statistics/confidence_ellipse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def confidence_ellipse(x, y, ax, n_std=3.0, facecolor='none', **kwargs):
4949
Input data.
5050
5151
ax : matplotlib.axes.Axes
52-
The axes object to draw the ellipse into.
52+
The Axes object to draw the ellipse into.
5353
5454
n_std : float
5555
The number of standard deviations to determine the ellipse's radiuses.

galleries/examples/subplots_axes_and_figures/axes_box_aspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
===============
55
66
This demo shows how to set the aspect of an Axes box directly via
7-
`~.Axes.set_box_aspect`. The box aspect is the ratio between axes height
7+
`~.Axes.set_box_aspect`. The box aspect is the ratio between Axes height
88
and axes width in physical units, independent of the data limits.
99
This is useful to e.g. produce a square plot, independent of the data it
1010
contains, or to have a usual plot with the same axes dimensions next to

galleries/examples/subplots_axes_and_figures/axes_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Axes Demo
44
=========
55
6-
Example use of ``fig.add_axes`` to create inset axes within the main plot axes.
6+
Example use of ``fig.add_axes`` to create inset Axes within the main plot Axes.
77
88
Please see also the :ref:`axes_grid_examples` section, and the following three
99
examples:

0 commit comments

Comments
 (0)