diff --git a/lib/matplotlib/tests/baseline_images/test_widgets/check_radio_buttons.png b/lib/matplotlib/tests/baseline_images/test_widgets/check_radio_buttons.png new file mode 100644 index 000000000000..c1ed74347bfe Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_widgets/check_radio_buttons.png differ diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py index 2555037828f1..46e5f4785176 100644 --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -9,7 +9,7 @@ import matplotlib.widgets as widgets import matplotlib.pyplot as plt -from matplotlib.testing.decorators import cleanup +from matplotlib.testing.decorators import cleanup, image_comparison from numpy.testing import assert_allclose @@ -271,3 +271,15 @@ def clicked_function(): pass cid = check.on_clicked(clicked_function) check.disconnect(cid) + + +@image_comparison(baseline_images=['check_radio_buttons'], extensions=['png'], + style='default') +def test_check_radio_buttons_image(): + get_ax() + plt.subplots_adjust(left=0.3) + rax1 = plt.axes([0.05, 0.7, 0.15, 0.15]) + rax2 = plt.axes([0.05, 0.2, 0.15, 0.15]) + widgets.RadioButtons(rax1, ('Radio 1', 'Radio 2', 'Radio 3')) + widgets.CheckButtons(rax2, ('Check 1', 'Check 2', 'Check 3'), + (False, True, True)) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 82633f78f6b6..68ef8310294c 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -540,9 +540,8 @@ def __init__(self, ax, labels, actives): w, h = dy / 2., dy / 2. x, y = 0.05, y - h / 2. - p = Rectangle(xy=(x, y), width=w, height=h, - facecolor=axcolor, - transform=ax.transAxes) + p = Rectangle(xy=(x, y), width=w, height=h, edgecolor='black', + facecolor=axcolor, transform=ax.transAxes) l1 = Line2D([x, x + w], [y + h, y], **lineparams) l2 = Line2D([x, x + w], [y, y + h], **lineparams) @@ -997,8 +996,8 @@ def __init__(self, ax, labels, active=0, activecolor='blue'): else: facecolor = axcolor - p = Circle(xy=(0.15, y), radius=0.05, facecolor=facecolor, - transform=ax.transAxes) + p = Circle(xy=(0.15, y), radius=0.05, edgecolor='black', + facecolor=facecolor, transform=ax.transAxes) self.labels.append(t) self.circles.append(p) @@ -2069,8 +2068,8 @@ def __init__(self, ax, onselect, drawtype='box', alpha=0.2, fill=True) rectprops['animated'] = self.useblit self.rectprops = rectprops - self.to_draw = self._shape_klass((0, 0), - 0, 1, visible=False, **self.rectprops) + self.to_draw = self._shape_klass((0, 0), 0, 1, visible=False, + **self.rectprops) self.ax.add_patch(self.to_draw) if drawtype == 'line': if lineprops is None: @@ -2481,9 +2480,9 @@ def onselect(verts): """ def __init__(self, ax, onselect=None, useblit=True, lineprops=None, - button=None): + button=None): _SelectorWidget.__init__(self, ax, onselect, useblit=useblit, - button=button) + button=button) self.verts = None