pog87/PtitPrince

cloud_kwargs are not passed on

Closed this issue · 3 comments

kwargs specified for the clouds are not passed on to the final plotting calls.

The kwargs are first handled here, within RainCloud:

kwcloud = {}; kwbox = {}; kwrain = {}; kwpoint = {}
for key, value in kwargs.items():
if "cloud_" in key:
kwcloud[key.replace("cloud_","")] = value
elif "box_" in key:
kwbox[key.replace("box_","")] = value
elif "rain_" in key:
kwrain[key.replace("rain_","")] = value
elif "point_" in key:
kwpoint[key.replace("point_","")] = value
else:
kwcloud[key] = value

A bit further down in the code, the cloud kwargs are passed on here to half_violinplot:

# Draw half-violin
half_violinplot(x = x, y = y, hue = hue, data = data,
order = order, hue_order = hue_order,
orient = orient, width = width_viol,
inner = None, palette = palette, bw = bw, linewidth = linewidth,
cut = cut, scale = scale, split = split, offset = offset, ax =ax, **kwcloud)

However, the half_violinplot function ignores the kwargs.

def half_violinplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None,
bw="scott", cut=2, scale="area", scale_hue=True, gridsize=100,
width=.8, inner="box", split=False, dodge=True, orient=None,
linewidth=None, color=None, palette=None, saturation=.75,
ax=None, offset=.15, **kwargs):
plotter = _Half_ViolinPlotter(x, y, hue, data, order, hue_order,
bw, cut, scale, scale_hue, gridsize,
width, inner, split, dodge, orient, linewidth,
color, palette, saturation, offset)
if ax is None:
ax = plt.gca()
plotter.plot(ax)
return ax

pog87 commented

thank you for the report. Version 0.2.4 now passes the kwargs to plotter.plot and subfunctions.

Thanks for working on this @pog87 :-)

pog87 commented

Thank you @sappelhoff for the best-written Issue I have ever received!