我想在一个图形中绘制多个海洋物体,而又不要使它们相互重叠。
有没有论据如何改变每个物体的位置?例如,等于R中的position_nudge?
请参见此处的https://i.stack.imgur.com/5X4kD.png
用于生成图形的代码
fig, ax = plt.subplots(figsize=(15,9))
for col in df:
ax.plot(df_x_jitter[col], df[col], 'o', alpha=.60, zorder=1, ms=14, mew=3)
ax.set_xticks(range(len(df.columns)))
ax.set_xticklabels(df.columns)
ax.set_xlim(-1,len(df.columns))
ax.spines['bottom'].set_lw('2.5')
ax.spines['left'].set_lw('2.5')
sns.despine(trim=False)
#Merge dataframe from wide to long for sns
df_long = pd.melt(df, value_vars=['1','2'])
sns.pointplot(x='variable', y='value', ci=95, data=df_long, join=False, scale=1.5, zorder=100, color = 'black', capsize = .015)
sns.violinplot(x='variable', y='value', data=df_long, hue = 'variable', split = True, inner = 'quartile',cut=0)```
[1]: https://i.stack.imgur.com/5X4kD.png