Python 如何使折线图更具可读性?

Python 如何使折线图更具可读性?,python,matplotlib,seaborn,Python,Matplotlib,Seaborn,我用seaborn和一些自定义数据制作了这个图。 它显示了3个不同基准分数根据设备价格的变化。 我设法用“twinx”来叠加所有3个基准测试,但现在这个图表简直无法读取。 如何平滑折线图的线条,使其更易于使用和阅读 我试着重新缩放蜱,但似乎我无法配置双轴的两个轴 plt.figure(figsize=(18,8)) pal = ["#073763"] caractere = 'prix' sns.lineplot(data = df_plus_cpu, x = caractere, y = '

我用seaborn和一些自定义数据制作了这个图。 它显示了3个不同基准分数根据设备价格的变化。 我设法用“twinx”来叠加所有3个基准测试,但现在这个图表简直无法读取。 如何平滑折线图的线条,使其更易于使用和阅读

我试着重新缩放蜱,但似乎我无法配置双轴的两个轴

plt.figure(figsize=(18,8))
pal = ["#073763"]
caractere = 'prix'

sns.lineplot(data = df_plus_cpu, x = caractere, y = 'geekbench_s_core', label = 'Geekbench 4.3 64 Bit Single-Core Score', color = '#71a7d6')
sns.lineplot(data = df_plus_cpu, x = caractere, y = 'geekbench_m_core', label = 'Geekbench 4.3 64 Bit Multi-Core Score', color = '#073763')
ax2 = plt.twinx()
sns.lineplot(data = df_plus_cpu, x = caractere, y = 'passmark', ax=ax2, label = 'PassMark PerformanceTest Mobile V1 CPU Tests', color = '#EA9999')
目前,我的图表如下所示:

通过一些示例数据演示了两个选项(当然不是唯一的选项):

#[1]用滚动平均值绘制重点趋势图
df=pd.read_csv(“https://vincentarelbundock.github.io/Rdatasets/csv/datasets/AirPassengers.csv,索引_col=0)
df['value_rolling']=df['value'].滚动(12).平均值()
sns.lineplot(x='time',y='value\u rolling',data=df,color='steelblue',线宽=2.5)
sns.lineplot(x='time',y='value',data=df,color='0.5',alpha=0.5,linewidth=2)
plt.show()

#[2]使用regplot断开“嘈杂”点并强调趋势
sns.regplot(x='time',y='value',ci=None,data=df,
散射系数=dict(颜色=0.5',α=0.3),
行(ls='-',color='steelblue'))
plt.xlim(df['time'].min()-0.5,df['time'].max()+0.5)
plt.show()

第二个解决方案实际上效果很好,谢谢你,布伦丹。