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

Appearance settings

Commit 4c5fca7

Browse filesBrowse files
authored
Merge pull request #7861 from naoyak/widget-edges
Make radio and check buttons visible
2 parents 81075b5 + dedcac3 commit 4c5fca7
Copy full SHA for 4c5fca7

File tree

Expand file treeCollapse file tree

3 files changed

+21
-10
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-10
lines changed
Loading

‎lib/matplotlib/tests/test_widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_widgets.py
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import matplotlib.widgets as widgets
1111
import matplotlib.pyplot as plt
12-
from matplotlib.testing.decorators import cleanup
12+
from matplotlib.testing.decorators import cleanup, image_comparison
1313

1414
from numpy.testing import assert_allclose
1515

@@ -271,3 +271,15 @@ def clicked_function():
271271
pass
272272
cid = check.on_clicked(clicked_function)
273273
check.disconnect(cid)
274+
275+
276+
@image_comparison(baseline_images=['check_radio_buttons'], extensions=['png'],
277+
style='default')
278+
def test_check_radio_buttons_image():
279+
get_ax()
280+
plt.subplots_adjust(left=0.3)
281+
rax1 = plt.axes([0.05, 0.7, 0.15, 0.15])
282+
rax2 = plt.axes([0.05, 0.2, 0.15, 0.15])
283+
widgets.RadioButtons(rax1, ('Radio 1', 'Radio 2', 'Radio 3'))
284+
widgets.CheckButtons(rax2, ('Check 1', 'Check 2', 'Check 3'),
285+
(False, True, True))

‎lib/matplotlib/widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/widgets.py
+8-9Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,8 @@ def __init__(self, ax, labels, actives):
540540
w, h = dy / 2., dy / 2.
541541
x, y = 0.05, y - h / 2.
542542

543-
p = Rectangle(xy=(x, y), width=w, height=h,
544-
facecolor=axcolor,
545-
transform=ax.transAxes)
543+
p = Rectangle(xy=(x, y), width=w, height=h, edgecolor='black',
544+
facecolor=axcolor, transform=ax.transAxes)
546545

547546
l1 = Line2D([x, x + w], [y + h, y], **lineparams)
548547
l2 = Line2D([x, x + w], [y, y + h], **lineparams)
@@ -997,8 +996,8 @@ def __init__(self, ax, labels, active=0, activecolor='blue'):
997996
else:
998997
facecolor = axcolor
999998

1000-
p = Circle(xy=(0.15, y), radius=0.05, facecolor=facecolor,
1001-
transform=ax.transAxes)
999+
p = Circle(xy=(0.15, y), radius=0.05, edgecolor='black',
1000+
facecolor=facecolor, transform=ax.transAxes)
10021001

10031002
self.labels.append(t)
10041003
self.circles.append(p)
@@ -2069,8 +2068,8 @@ def __init__(self, ax, onselect, drawtype='box',
20692068
alpha=0.2, fill=True)
20702069
rectprops['animated'] = self.useblit
20712070
self.rectprops = rectprops
2072-
self.to_draw = self._shape_klass((0, 0),
2073-
0, 1, visible=False, **self.rectprops)
2071+
self.to_draw = self._shape_klass((0, 0), 0, 1, visible=False,
2072+
**self.rectprops)
20742073
self.ax.add_patch(self.to_draw)
20752074
if drawtype == 'line':
20762075
if lineprops is None:
@@ -2481,9 +2480,9 @@ def onselect(verts):
24812480
"""
24822481

24832482
def __init__(self, ax, onselect=None, useblit=True, lineprops=None,
2484-
button=None):
2483+
button=None):
24852484
_SelectorWidget.__init__(self, ax, onselect, useblit=useblit,
2486-
button=button)
2485+
button=button)
24872486

24882487
self.verts = None
24892488

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.