我使用以下代码创建violinplot:
import seaborn as sns
ax = sns.violinplot(data=df[['SoundProduction','SoundForecast','diff']])
ax.set_ylabel("Sound power level [dB(A)]")
结果如下:
有没有什么方法可以把diff
绘制在第二个y轴上,这样所有三个序列都变得清晰可见?你知道吗
另外,有没有办法在两个系列之间画一条垂直线?在这种情况下,我希望在SoundForecast
和diff
之间有一条垂直线,一旦它们被绘制在两个不同的轴上。你知道吗
您可以使用多个子图来实现这一点,这些子图可以使用plt.subplots轻松设置(请参阅更多subplot examples)。你知道吗
这允许您在适当的比例上显示分布,并且不会“浪费”显示空间。大多数(全部?)seaborn的plotting函数接受
ax=
参数,因此您可以设置渲染绘图的轴。轴之间也有明显的分隔。你知道吗相关问题 更多 >
编程相关推荐