Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Widgets: Remove deprecations and make arguments keyword only#26853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletionci/mypy-stubtest-allowlist.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,7 +54,6 @@ matplotlib.cm.register_cmap
matplotlib.cm.unregister_cmap
matplotlib.collections.PolyCollection.span_where
matplotlib.gridspec.GridSpecBase.get_grid_positions
matplotlib.widgets.MultiCursor.needclear

# 3.8 deprecations
matplotlib.cbook.get_sample_data
Expand Down
26 changes: 26 additions & 0 deletionsdoc/api/next_api_changes/removals/26853-OG.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
Most arguments to widgets have been made keyword-only
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Passing all but the very few first arguments positionally in the constructors
of Widgets is now keyword-only. In general, all optional arguments are keyword-only.

``RadioButtons.circles``
~~~~~~~~~~~~~~~~~~~~~~~~

... is removed. (``RadioButtons`` now draws itself using `~.Axes.scatter`.)

``CheckButtons.rectangles`` and ``CheckButtons.lines``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``CheckButtons.rectangles`` and ``CheckButtons.lines`` are removed.
(``CheckButtons`` now draws itself using `~.Axes.scatter`.)

Remove unused parameter *x* to ``TextBox.begin_typing``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This parameter was unused in the method, but was a required argument.

``MultiCursor.needclear``
~~~~~~~~~~~~~~~~~~~~~~~~~

... is removed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 0 additions & 59 deletionslib/matplotlib/tests/test_widgets.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,8 +7,6 @@
import matplotlib.colors as mcolors
import matplotlib.widgets as widgets
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from matplotlib.lines import Line2D
from matplotlib.testing.decorators import check_figures_equal, image_comparison
from matplotlib.testing.widgets import (click_and_drag, do_event, get_ax,
mock_event, noop)
Expand DownExpand Up@@ -1055,16 +1053,10 @@ def test_check_radio_buttons_image():

rax1 = fig.add_axes((0.05, 0.7, 0.2, 0.15))
rb1 = widgets.RadioButtons(rax1, ('Radio 1', 'Radio 2', 'Radio 3'))
with pytest.warns(DeprecationWarning,
match='The circles attribute was deprecated'):
rb1.circles # Trigger the old-style elliptic radiobuttons.

rax2 = fig.add_axes((0.05, 0.5, 0.2, 0.15))
cb1 = widgets.CheckButtons(rax2, ('Check 1', 'Check 2', 'Check 3'),
(False, True, True))
with pytest.warns(DeprecationWarning,
match='The rectangles attribute was deprecated'):
cb1.rectangles # Trigger old-style Rectangle check boxes

rax3 = fig.add_axes((0.05, 0.3, 0.2, 0.15))
rb3 = widgets.RadioButtons(
Expand DownExpand Up@@ -1164,57 +1156,6 @@ def test_check_button_props(fig_test, fig_ref):
cb.set_check_props({**check_props, 's': (24 / 2)**2})


@check_figures_equal(extensions=["png"])
def test_check_buttons_rectangles(fig_test, fig_ref):
# Test should be removed once .rectangles is removed
cb = widgets.CheckButtons(fig_test.subplots(), ["", ""],
[False, False])
with pytest.warns(DeprecationWarning,
match='The rectangles attribute was deprecated'):
cb.rectangles
ax = fig_ref.add_subplot(xticks=[], yticks=[])
ys = [2/3, 1/3]
dy = 1/3
w, h = dy / 2, dy / 2
rectangles = [
Rectangle(xy=(0.05, ys[i] - h / 2), width=w, height=h,
edgecolor="black",
facecolor="none",
transform=ax.transAxes
)
for i, y in enumerate(ys)
]
for rectangle in rectangles:
ax.add_patch(rectangle)


@check_figures_equal(extensions=["png"])
def test_check_buttons_lines(fig_test, fig_ref):
# Test should be removed once .lines is removed
cb = widgets.CheckButtons(fig_test.subplots(), ["", ""], [True, True])
with pytest.warns(DeprecationWarning,
match='The lines attribute was deprecated'):
cb.lines
for rectangle in cb._rectangles:
rectangle.set_visible(False)
ax = fig_ref.add_subplot(xticks=[], yticks=[])
ys = [2/3, 1/3]
dy = 1/3
w, h = dy / 2, dy / 2
lineparams = {'color': 'k', 'linewidth': 1.25,
'transform': ax.transAxes,
'solid_capstyle': 'butt'}
for i, y in enumerate(ys):
x, y = 0.05, y - h / 2
l1 = Line2D([x, x + w], [y + h, y], **lineparams)
l2 = Line2D([x, x + w], [y, y + h], **lineparams)

l1.set_visible(True)
l2.set_visible(True)
ax.add_line(l1)
ax.add_line(l2)


def test_slider_slidermin_slidermax_invalid():
fig, ax = plt.subplots()
# test min/max with floats
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp