Skip to content

Commit 761ff03

Browse files
Update Branch
2 parents f5f403f + ebf6f84 commit 761ff03

File tree

7 files changed

+30
-26
lines changed

7 files changed

+30
-26
lines changed

.github/workflows/codeql-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
persist-credentials: false
3232

3333
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
34+
uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
3535
with:
3636
languages: ${{ matrix.language }}
3737

@@ -42,4 +42,4 @@ jobs:
4242
pip install --user -v .
4343
4444
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
45+
uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``GridHelperCurveLinear.get_tick_iterator``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is removed with no replacement.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*nth_coord* parameter to axisartist helpers for fixed axis
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Helper APIs in `.axisartist` for generating a "fixed" axis on rectilinear axes
5+
(`.FixedAxisArtistHelperRectilinear`) no longer take a *nth_coord* parameter.
6+
That parameter is entirely inferred from the (required) *loc* parameter.
7+
8+
For curvilinear axes, the *nth_coord* parameter remains supported (it affects
9+
the *ticks*, not the axis position itself), but it is now keyword-only.

lib/matplotlib/axes/_axes.py

+3
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,9 @@ def pie(self, x, explode=None, labels=None, colors=None,
33083308

33093309
sx = x.sum()
33103310

3311+
if sx == 0:
3312+
raise ValueError('All wedge sizes are zero')
3313+
33113314
if normalize:
33123315
x = x / sx
33133316
elif sx > 1:

lib/matplotlib/tests/test_axes.py

+6
Original file line numberDiff line numberDiff line change
@@ -9747,3 +9747,9 @@ def test_pie_non_finite_values():
97479747

97489748
with pytest.raises(ValueError, match='Wedge sizes must be finite numbers'):
97499749
ax.pie(df, labels=['A', 'B', 'C'])
9750+
9751+
9752+
def test_pie_all_zeros():
9753+
fig, ax = plt.subplots()
9754+
with pytest.raises(ValueError, match="All wedge sizes are zero"):
9755+
ax.pie([0, 0], labels=["A", "B"])

lib/mpl_toolkits/axisartist/axislines.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ def _to_xy(self, values, const):
120120
class _FixedAxisArtistHelperBase(_AxisArtistHelperBase):
121121
"""Helper class for a fixed (in the axes coordinate) axis."""
122122

123-
@_api.delete_parameter("3.9", "nth_coord")
124-
def __init__(self, loc, nth_coord=None):
123+
def __init__(self, loc):
125124
"""``nth_coord = 0``: x-axis; ``nth_coord = 1``: y-axis."""
126125
super().__init__(_api.check_getitem(
127126
{"bottom": 0, "top": 0, "left": 1, "right": 1}, loc=loc))
@@ -171,12 +170,7 @@ def get_line(self, axes):
171170

172171
class FixedAxisArtistHelperRectilinear(_FixedAxisArtistHelperBase):
173172

174-
@_api.delete_parameter("3.9", "nth_coord")
175-
def __init__(self, axes, loc, nth_coord=None):
176-
"""
177-
nth_coord = along which coordinate value varies
178-
in 2D, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
179-
"""
173+
def __init__(self, axes, loc):
180174
super().__init__(loc)
181175
self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]
182176

@@ -311,10 +305,9 @@ def __init__(self, axes):
311305
super().__init__()
312306
self.axes = axes
313307

314-
@_api.delete_parameter(
315-
"3.9", "nth_coord", addendum="'nth_coord' is now inferred from 'loc'.")
316308
def new_fixed_axis(
317-
self, loc, nth_coord=None, axis_direction=None, offset=None, axes=None):
309+
self, loc, *, axis_direction=None, offset=None, axes=None
310+
):
318311
if axes is None:
319312
_api.warn_external(
320313
"'new_fixed_axis' explicitly requires the axes keyword.")

lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ def update_grid_finder(self, aux_trans=None, **kwargs):
316316
self.grid_finder.update(**kwargs)
317317
self._old_limits = None # Force revalidation.
318318

319-
@_api.make_keyword_only("3.9", "nth_coord")
320319
def new_fixed_axis(
321-
self, loc, nth_coord=None, axis_direction=None, offset=None, axes=None):
320+
self, loc, *, axis_direction=None, offset=None, axes=None, nth_coord=None
321+
):
322322
if axes is None:
323323
axes = self.axes
324324
if axis_direction is None:
@@ -351,14 +351,3 @@ def get_gridlines(self, which="major", axis="both"):
351351
if axis in ["both", "y"]:
352352
grid_lines.extend([gl.T for gl in self._grid_info["lat"]["lines"]])
353353
return grid_lines
354-
355-
@_api.deprecated("3.9")
356-
def get_tick_iterator(self, nth_coord, axis_side, minor=False):
357-
angle_tangent = dict(left=90, right=90, bottom=0, top=0)[axis_side]
358-
lon_or_lat = ["lon", "lat"][nth_coord]
359-
if not minor: # major ticks
360-
for tick in self._grid_info[lon_or_lat]["ticks"][axis_side]:
361-
yield *tick["loc"], angle_tangent, tick["label"]
362-
else:
363-
for tick in self._grid_info[lon_or_lat]["ticks"][axis_side]:
364-
yield *tick["loc"], angle_tangent, ""

0 commit comments

Comments
 (0)