我使用seaborn和一些自定义数据制作了这张图。它显示了3个不同的基准分数根据设备的价格的演变。我设法用"twinx“堆叠了所有3个基准测试,但是这个图现在根本看不懂。我怎样才能使线形图的线条变得更平滑,使其更具用户友好性和可读性?
我尝试重新缩放ticks,但似乎无法同时配置twinx的两个轴。
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')目前,我的图表如下所示:

发布于 2019-07-15 02:36:24
通过一些示例数据演示了两种选择(当然不是唯一的):
# [1] Plot with rolling average to emphase trend
df = pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/datasets/AirPassengers.csv", index_col=0)
df['value_rolling'] = df['value'].rolling(12).mean()
sns.lineplot(x='time', y='value_rolling', data=df, color='steelblue', linewidth=2.5)
sns.lineplot(x='time', y='value', data=df, color='0.5', alpha=0.5, linewidth=2)
plt.show()

# [2] Use regplot to disconnect 'noisy' points and emphasize trend
sns.regplot(x='time', y='value', ci=None, data=df,
scatter_kws=dict(color='0.5', alpha=0.3),
line_kws=dict(ls='-', color='steelblue'))
plt.xlim(df['time'].min()-0.5, df['time'].max()+0.5)
plt.show()

https://stackoverflow.com/questions/57029516
复制相似问题