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

Skip to content

Commit a2ebfdd

Browse files
authored
Merge branch 'matplotlib:main' into main
2 parents be07ad1 + 401d7ce commit a2ebfdd

File tree

15 files changed

+138
-338
lines changed

15 files changed

+138
-338
lines changed

ci/mypy-stubtest-allowlist.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ matplotlib.figure.Figure.set_tight_layout
5353
matplotlib.cm.register_cmap
5454
matplotlib.cm.unregister_cmap
5555
matplotlib.collections.PolyCollection.span_where
56-
matplotlib.gridspec.GridSpecBase.get_grid_positions
57-
matplotlib.widgets.MultiCursor.needclear
5856

5957
# 3.8 deprecations
6058
matplotlib.cbook.get_sample_data
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Most arguments to widgets have been made keyword-only
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Passing all but the very few first arguments positionally in the constructors
5+
of Widgets is now keyword-only. In general, all optional arguments are keyword-only.
6+
7+
``RadioButtons.circles``
8+
~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+
... is removed. (``RadioButtons`` now draws itself using `~.Axes.scatter`.)
11+
12+
``CheckButtons.rectangles`` and ``CheckButtons.lines``
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
15+
``CheckButtons.rectangles`` and ``CheckButtons.lines`` are removed.
16+
(``CheckButtons`` now draws itself using `~.Axes.scatter`.)
17+
18+
Remove unused parameter *x* to ``TextBox.begin_typing``
19+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20+
21+
This parameter was unused in the method, but was a required argument.
22+
23+
``MultiCursor.needclear``
24+
~~~~~~~~~~~~~~~~~~~~~~~~~
25+
26+
... is removed.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``raw`` parameter
2+
~~~~~~~~~~~~~~~~~
3+
4+
... of `.GridSpecBase.get_grid_positions` is removed without replacements.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
``offsetbox.bbox_artist``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is removed. This was just a wrapper to call `.patches.bbox_artist` if a flag is set in the file, so use that directly if you need the behavior.
5+
6+
``offsetBox.get_extent_offsets`` and ``offsetBox.get_extent``
7+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
9+
... are removed; these methods are also removed on all subclasses of `.OffsetBox`.
10+
11+
... To get the offsetbox extents, instead of ``get_extent``, use `.OffsetBox.get_bbox`, which directly returns a `.Bbox` instance.
12+
13+
... To also get the child offsets, instead of ``get_extent_offsets``, separately call `~.OffsetBox.get_offset` on each children after triggering a draw.

doc/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ def _parse_skip_subdirs_file():
4747
but you can skip subdirectories of 'users'. Doing this
4848
can make partial builds very fast.
4949
"""
50-
default_skip_subdirs = ['users/prev_whats_new/*', 'api/*', 'gallery/*',
51-
'tutorials/*', 'plot_types/*', 'devel/*']
50+
default_skip_subdirs = [
51+
'users/prev_whats_new/*', 'users/explain/*', 'api/*', 'gallery/*',
52+
'tutorials/*', 'plot_types/*', 'devel/*']
5253
try:
5354
with open(".mpl_skip_subdirs.yaml", 'r') as fin:
5455
print('Reading subdirectories to skip from',

galleries/users_explain/artists/transforms_tutorial.py

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23,55 +23,51 @@
2323
:class:`~matplotlib.figure.SubFigure` instance.
2424
2525
26-
+----------------+-----------------------------------+---------------------------------------------------+
27-
|Coordinate |Description |Transformation object |
28-
|system | |from system to display |
29-
+================+===================================+===================================================+
30-
|"data" |The coordinate system of the data |``ax.transData`` |
31-
| |in the Axes. | |
32-
+----------------+-----------------------------------+---------------------------------------------------+
33-
|"axes" |The coordinate system of the |``ax.transAxes`` |
34-
| |`~matplotlib.axes.Axes`; (0, 0) | |
35-
| |is bottom left of the axes, and | |
36-
| |(1, 1) is top right of the axes. | |
37-
+----------------+-----------------------------------+---------------------------------------------------+
38-
|"subfigure" |The coordinate system of the |``subfigure.transSubfigure`` |
39-
| |`.SubFigure`; (0, 0) is bottom left| |
40-
| |of the subfigure, and (1, 1) is top| |
41-
| |right of the subfigure. If a | |
42-
| |figure has no subfigures, this is | |
43-
| |the same as ``transFigure``. | |
44-
+----------------+-----------------------------------+---------------------------------------------------+
45-
|"figure" |The coordinate system of the |``fig.transFigure`` |
46-
| |`.Figure`; (0, 0) is bottom left | |
47-
| |of the figure, and (1, 1) is top | |
48-
| |right of the figure. | |
49-
+----------------+-----------------------------------+---------------------------------------------------+
50-
|"figure-inches" |The coordinate system of the |``fig.dpi_scale_trans`` |
51-
| |`.Figure` in inches; (0, 0) is | |
52-
| |bottom left of the figure, and | |
53-
| |(width, height) is the top right | |
54-
| |of the figure in inches. | |
55-
+----------------+-----------------------------------+---------------------------------------------------+
56-
|"xaxis", |Blended coordinate systems, using |``ax.get_xaxis_transform()``, |
57-
|"yaxis" |data coordinates on one direction |``ax.get_yaxis_transform()`` |
58-
| |and axes coordinates on the other. | |
59-
+----------------+-----------------------------------+---------------------------------------------------+
60-
|"display" |The native coordinate system of the|`None`, or |
61-
| |output ; (0, 0) is the bottom left |:class:`~matplotlib.transforms.IdentityTransform()`|
62-
| |of the window, and (width, height) | |
63-
| |is top right of the output in | |
64-
| |"display units". | |
65-
| | | |
66-
| |The exact interpretation of the | |
67-
| |units depends on the back end. For | |
68-
| |example it is pixels for Agg and | |
69-
| |points for svg/pdf. | |
70-
+----------------+-----------------------------------+---------------------------------------------------+
71-
72-
73-
74-
26+
+----------------+-----------------------------------+-----------------------------+
27+
|Coordinate |Description |Transformation object |
28+
|system | |from system to display |
29+
+================+===================================+=============================+
30+
|"data" |The coordinate system of the data |``ax.transData`` |
31+
| |in the Axes. | |
32+
+----------------+-----------------------------------+-----------------------------+
33+
|"axes" |The coordinate system of the |``ax.transAxes`` |
34+
| |`~matplotlib.axes.Axes`; (0, 0) | |
35+
| |is bottom left of the axes, and | |
36+
| |(1, 1) is top right of the axes. | |
37+
+----------------+-----------------------------------+-----------------------------+
38+
|"subfigure" |The coordinate system of the |``subfigure.transSubfigure`` |
39+
| |`.SubFigure`; (0, 0) is bottom left| |
40+
| |of the subfigure, and (1, 1) is top| |
41+
| |right of the subfigure. If a | |
42+
| |figure has no subfigures, this is | |
43+
| |the same as ``transFigure``. | |
44+
+----------------+-----------------------------------+-----------------------------+
45+
|"figure" |The coordinate system of the |``fig.transFigure`` |
46+
| |`.Figure`; (0, 0) is bottom left | |
47+
| |of the figure, and (1, 1) is top | |
48+
| |right of the figure. | |
49+
+----------------+-----------------------------------+-----------------------------+
50+
|"figure-inches" |The coordinate system of the |``fig.dpi_scale_trans`` |
51+
| |`.Figure` in inches; (0, 0) is | |
52+
| |bottom left of the figure, and | |
53+
| |(width, height) is the top right | |
54+
| |of the figure in inches. | |
55+
+----------------+-----------------------------------+-----------------------------+
56+
|"xaxis", |Blended coordinate systems, using |``ax.get_xaxis_transform()``,|
57+
|"yaxis" |data coordinates on one direction |``ax.get_yaxis_transform()`` |
58+
| |and axes coordinates on the other. | |
59+
+----------------+-----------------------------------+-----------------------------+
60+
|"display" |The native coordinate system of the|`None`, or |
61+
| |output ; (0, 0) is the bottom left |`.IdentityTransform()` |
62+
| |of the window, and (width, height) | |
63+
| |is top right of the output in | |
64+
| |"display units". | |
65+
| | | |
66+
| |The exact interpretation of the | |
67+
| |units depends on the back end. For | |
68+
| |example it is pixels for Agg and | |
69+
| |points for svg/pdf. | |
70+
+----------------+-----------------------------------+-----------------------------+
7571
7672
The `~matplotlib.transforms.Transform` objects are naive to the source and
7773
destination coordinate systems, however the objects referred to in the table
@@ -247,14 +243,15 @@
247243
#
248244
# After the *data* coordinate system, *axes* is probably the second most
249245
# useful coordinate system. Here the point (0, 0) is the bottom left of
250-
# your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the
251-
# top right. You can also refer to points outside the range, so (-0.1,
252-
# 1.1) is to the left and above your axes. This coordinate system is
253-
# extremely useful when placing text in your axes, because you often
254-
# want a text bubble in a fixed, location, e.g., the upper left of the axes
255-
# pane, and have that location remain fixed when you pan or zoom. Here
256-
# is a simple example that creates four panels and labels them 'A', 'B',
257-
# 'C', 'D' as you often see in journals.
246+
# your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the top
247+
# right. You can also refer to points outside the range, so (-0.1, 1.1)
248+
# is to the left and above your axes. This coordinate system is extremely
249+
# useful when placing text in your axes, because you often want a text bubble
250+
# in a fixed, location, e.g., the upper left of the axes pane, and have that
251+
# location remain fixed when you pan or zoom. Here is a simple example that
252+
# creates four panels and labels them 'A', 'B', 'C', 'D' as you often see in
253+
# journals. A more sophisticated approach for such labeling is presented at
254+
# :doc:`/gallery/text_labels_and_annotations/label_subplots`.
258255

259256
fig = plt.figure()
260257
for i, label in enumerate(('A', 'B', 'C', 'D')):

lib/matplotlib/backends/backend_qt.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ def configure_subplots(self):
759759
self.canvas.mpl_connect(
760760
"close_event", lambda e: self._subplot_dialog.reject())
761761
self._subplot_dialog.update_from_current_subplotpars()
762+
self._subplot_dialog.setModal(True)
762763
self._subplot_dialog.show()
763764
return self._subplot_dialog
764765

lib/matplotlib/gridspec.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ def get_height_ratios(self):
141141
"""
142142
return self._row_height_ratios
143143

144-
@_api.delete_parameter("3.7", "raw")
145-
def get_grid_positions(self, fig, raw=False):
144+
def get_grid_positions(self, fig):
146145
"""
147146
Return the positions of the grid cells in figure coordinates.
148147
@@ -151,11 +150,6 @@ def get_grid_positions(self, fig, raw=False):
151150
fig : `~matplotlib.figure.Figure`
152151
The figure the grid should be applied to. The subplot parameters
153152
(margins and spacing between subplots) are taken from *fig*.
154-
raw : bool, default: False
155-
If *True*, the subplot parameters of the figure are not taken
156-
into account. The grid spans the range [0, 1] in both directions
157-
without margins and there is no space between grid cells. This is
158-
used for constrained_layout.
159153
160154
Returns
161155
-------
@@ -164,22 +158,13 @@ def get_grid_positions(self, fig, raw=False):
164158
figure coordinates.
165159
"""
166160
nrows, ncols = self.get_geometry()
167-
168-
if raw:
169-
left = 0.
170-
right = 1.
171-
bottom = 0.
172-
top = 1.
173-
wspace = 0.
174-
hspace = 0.
175-
else:
176-
subplot_params = self.get_subplot_params(fig)
177-
left = subplot_params.left
178-
right = subplot_params.right
179-
bottom = subplot_params.bottom
180-
top = subplot_params.top
181-
wspace = subplot_params.wspace
182-
hspace = subplot_params.hspace
161+
subplot_params = self.get_subplot_params(fig)
162+
left = subplot_params.left
163+
right = subplot_params.right
164+
bottom = subplot_params.bottom
165+
top = subplot_params.top
166+
wspace = subplot_params.wspace
167+
hspace = subplot_params.hspace
183168
tot_width = right - left
184169
tot_height = top - bottom
185170

lib/matplotlib/gridspec.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class GridSpecBase:
3030
def set_height_ratios(self, height_ratios: ArrayLike | None) -> None: ...
3131
def get_height_ratios(self) -> ArrayLike: ...
3232
def get_grid_positions(
33-
self, fig: Figure, raw: bool = ...
33+
self, fig: Figure
3434
) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: ...
3535
@staticmethod
3636
def _check_gridspec_exists(figure: Figure, nrows: int, ncols: int) -> GridSpec: ...

lib/matplotlib/offsetbox.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ def get_offset(self, *args, **kwargs):
6161
return get_offset
6262

6363

64-
@_api.deprecated("3.7", alternative='patches.bbox_artist')
65-
def bbox_artist(*args, **kwargs):
66-
if DEBUG:
67-
mbbox_artist(*args, **kwargs)
68-
69-
7064
# for debugging use
7165
def _bbox_artist(*args, **kwargs):
7266
if DEBUG:
@@ -366,32 +360,6 @@ def get_bbox(self, renderer):
366360
bbox, offsets = self._get_bbox_and_child_offsets(renderer)
367361
return bbox
368362

369-
@_api.deprecated("3.7", alternative="get_bbox and child.get_offset")
370-
def get_extent_offsets(self, renderer):
371-
"""
372-
Update offset of the children and return the extent of the box.
373-
374-
Parameters
375-
----------
376-
renderer : `.RendererBase` subclass
377-
378-
Returns
379-
-------
380-
width
381-
height
382-
xdescent
383-
ydescent
384-
list of (xoffset, yoffset) pairs
385-
"""
386-
bbox, offsets = self._get_bbox_and_child_offsets(renderer)
387-
return bbox.width, bbox.height, -bbox.x0, -bbox.y0, offsets
388-
389-
@_api.deprecated("3.7", alternative="get_bbox")
390-
def get_extent(self, renderer):
391-
"""Return a tuple ``width, height, xdescent, ydescent`` of the box."""
392-
bbox = self.get_bbox(renderer)
393-
return bbox.width, bbox.height, -bbox.x0, -bbox.y0
394-
395363
def get_window_extent(self, renderer=None):
396364
# docstring inherited
397365
if renderer is None:

lib/matplotlib/offsetbox.pyi

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ from typing import Any, Literal, overload
1515

1616
DEBUG: bool
1717

18-
def bbox_artist(*args, **kwargs) -> None: ...
1918
def _get_packed_offsets(
2019
widths: Sequence[float],
2120
total: float | None,
@@ -51,12 +50,6 @@ class OffsetBox(martist.Artist):
5150
def get_visible_children(self) -> list[martist.Artist]: ...
5251
def get_children(self) -> list[martist.Artist]: ...
5352
def get_bbox(self, renderer: RendererBase) -> Bbox: ...
54-
def get_extent_offsets(
55-
self, renderer: RendererBase
56-
) -> tuple[float, float, float, float, list[tuple[float, float]]]: ...
57-
def get_extent(
58-
self, renderer: RendererBase
59-
) -> tuple[float, float, float, float]: ...
6053
def get_window_extent(self, renderer: RendererBase | None = ...) -> Bbox: ...
6154

6255
class PackerBase(OffsetBox):

0 commit comments

Comments
 (0)