我正在尝试更改 Seaborn 中小提琴的边缘颜色。
下面的代码对我有用。
ax=sns.violinplot(data=df, x="#", y="SleepAmount", hue="Thr", palette=my_pal, split=True,linewidth = 1, inner=None)
ax2 = sns.pointplot(x="#", y="SleepAmount", hue="Thr", data=df, dodge=0.3, join=False, palette=['black'], ax=ax,errwidth=1, ci="sd", markers="_") plt.setp(ax.collections, edgecolor="k")
plt.setp(ax2.collections, edgecolor="k")
但是当我使用facetgrid时,我不知道如何采用plt.setp(ax.collections, edgecolor="k")
进入下面的facetgrid地图。
g = sns.FacetGrid(df, col="temperature",sharey=True)
g=g.map(sns.violinplot,"#", "latency", "Thr", palette=my_pal, split=True, linewidth = 1, inner=None,data=df)
g=g.map(sns.pointplot, "#", "latency", "Thr", data=df, dodge=0.3, join=False, palette=['black'],errwidth=1, ci="sd", markers="_")
我已经尝试了很多事情。喜欢,
sns.set_edgecolor('k')
sns.set_style( {"lines.color": "k"})
sns.set_collections({'edgecolor':'k'})
g.fig.get_edgecolor()[0].set_edge("k")
g.setp.get_collections()[0].set_edgecolor("k")
谁能帮我吗?
还有一个快速问题,
除了白色网格和深色网格之外,是否可以更改网格颜色?
Facecolor 对我不起作用,因为它为所有背景(包括刻度线和标签区域)着色。我只想更改网格区域。
谢谢你!