How to format/access inner boxplots of a violin catplot in seaborn?

87 Views Asked by At

seaborn catplot with kind=violin

I'm looking to change the formatting of the inner boxplots for the violin plots within this catplot. I have tried using the violinplot parameter inner_kws=dict(box_width=15, whis_width=2, color=".8") to no avail.

code used

p = sns.catplot(data=sample4, x='modelID', y='error', hue='isDF', size=3, kind='violin', split=True, height=5, aspect=1.8, inner='box', fill=False, inner_kws=dict(box_width=15, whis_width=2, color=".8"))
p.set(ylabel='occupancy error', title='Error distribution by model type for busy variable legs')
p.set_xticklabels(rotation=45)

for i,ax in enumerate(p.axes.flatten()):
    ax.axhline(0.2, ls='--', color='k', alpha=0.1, zorder=0)
    ax.axhline(-0.2, ls='--', color='k', alpha=0.1, zorder=0)
    ax.axhline(0, ls='--', color='k', alpha=0.3, zorder=0)

sample data

           modelID isDF     error
622   MonthAverage   No -0.182288
1096       S-AVG-1   No  0.122069
1277       S-AVG-4   No  0.105147
2189      NoChange  Yes -0.189221
1250       S-AVG-4   No -0.037150
1530           GMM  Yes  0.068475
1553           GMM  Yes -0.543998
789   MonthAverage   No -0.164985
1061       S-AVG-1   No  0.064435
1602  MonthAverage  Yes -0.062130
448            GMM   No  0.478873
1513           GMM  Yes  0.166998
1349       S-AVG-4   No -0.069806
1860           GAM  Yes  0.034769
830       NoChange   No -0.150372
1151       S-AVG-1   No -0.142022
846       NoChange   No -0.385930
1847           GAM  Yes  0.102694
1049       S-AVG-1   No  0.095174
921       NoChange   No -0.102451
0

There are 0 best solutions below