如果我做类似的事情:
import seaborn as sns
tips = sns.load_dataset("tips")
ax = sns.violinplot(x="day", y="total_bill", data=tips)
如何通过不同的影线更改颜色? 我尝试了与箱线图相同的方法,但没有成功。
最佳答案
IIUC:
import seaborn as sns
import matplotlib as mpl
tips = sns.load_dataset("tips")
hatch = ['/','\\','+','o']
ihatch = iter(hatch)
ax = sns.violinplot(x="day", y="total_bill", data=tips, color='g')
_ = [i.set_hatch(next(ihatch)) for i in ax.get_children() if isinstance(i, mpl.collections.PolyCollection)]
输出:
关于python - 如何在seaborn fiddle 图上添加阴影?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59307192/