简体   繁体   中英

How do I change errorbar & cap thickness in Seaborn 0.9.0

I'm plotting multiple ANOVA studies and I would like my error bar width and their cap thickness to be less than the trend line. When plotting a 3-way ANOVA, with error bars and caps, it can feel crowded. My current plot looks somethings like this: 三向方差分析,厚度均匀

My function for plotting this is:

sns.catplot(x="dose", y="somethings", hue="position", kind="point", 
        palette=sns.xkcd_palette(colors), capsize=.15, data=df, aspect=1.5)

I have tried to include keywords such as lw_conf ( https://github.com/mwaskom/seaborn/pull/898 ), but I'm not sure what happened to it's functionality after factorplot was changed to catplot. I have also tried errorbar keywords from matplotlib such as, elinewidth and capthick . Catplot seems to take capsize as a keyword argument but I don't know what other keywords it might take or what happened to lw_conf . Any feedback about what may have happened to that keyword or a new way of accomplishing this task would be appreciated. Thanks!

catplot passes extra kwargs to the underlying plotting function. Since you are using kind="point" , the plotting function is sns.pointplot() . The documentation for that function mentions the parameter:

errwidth : float, optional

Thickness of error bar lines (and caps).

Therefore you only need to include errwidth= in your call to catplot :

exercise = sns.load_dataset("exercise")
sns.catplot(x="time", y="pulse", hue="kind", kind="point", 
            capsize=.15, data=exercise, aspect=1.5, errwidth=0.5)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM