Skip to content

Commit 4577453

Browse files
committed
Make violin return bodies or tuple w/ error bars instead of dict
1 parent dc11e50 commit 4577453

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

proplot/axes/plot.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3424,7 +3424,9 @@ def _apply_boxplot(
34243424
kw['showmeans'] = kw['meanline'] = True
34253425

34263426
# Call function
3427-
x, y, kw = self._parse_plot1d(x, y, autoy=False, autoguide=False, vert=vert, **kw) # noqa: E501
3427+
x, y, kw = self._parse_plot1d(
3428+
x, y, autoy=False, autoguide=False, vert=vert, **kw
3429+
)
34283430
kw.setdefault('positions', x)
34293431
artists = self._plot_native('boxplot', y, vert=vert, **kw)
34303432

@@ -3530,7 +3532,7 @@ def _apply_violinplot(self, x, y, vert=True, **kwargs):
35303532
x, y, kw = self._parse_plot1d(x, y, autoy=False, autoguide=False, vert=vert, **kw) # noqa: E501
35313533
y, kw = data._dist_reduce(y, **kw)
35323534
kw = self._parse_cycle(**kw)
3533-
*eb, kw = self._plot_errorbars(x, y, vert=vert, default_boxes=True, **kw) # noqa: E501
3535+
*eb, kw = self._plot_errorbars(x, y, vert=vert, default_boxes=True, **kw)
35343536
kw.pop('labels', None) # already applied in _parse_plot1d
35353537
kw.setdefault('positions', x)
35363538
y = _not_none(kw.pop('distribution'), y) # might not have reduced the data
@@ -3541,11 +3543,9 @@ def _apply_violinplot(self, x, y, vert=True, **kwargs):
35413543

35423544
# Modify body settings
35433545
artists = artists or {} # necessary?
3544-
artists = {
3545-
key: cbook.silent_list(type(objs[0]).__name__, objs) if objs else objs
3546-
for key, objs in artists.items()
3547-
}
3548-
bodies = artists.get('bodies', ())
3546+
bodies = artists.pop('bodies', ()) # should be no other entries
3547+
if bodies:
3548+
bodies = cbook.silent_list(type(bodies[0]).__name__, bodies)
35493549
if not isinstance(fillalpha, list):
35503550
fillalpha = [fillalpha] * len(bodies)
35513551
if not isinstance(fillcolor, list):
@@ -3560,7 +3560,7 @@ def _apply_violinplot(self, x, y, vert=True, **kwargs):
35603560
body.set_facecolor(fillcolor[i])
35613561
if edgecolor[i] is not None:
35623562
body.set_edgecolor(edgecolor[i])
3563-
return artists
3563+
return (bodies, *eb) if eb else bodies
35643564

35653565
@docstring._snippet_manager
35663566
def violin(self, *args, **kwargs):

0 commit comments

Comments
 (0)