我的意图是使用matplotlib和seaborn重新创建以下图形:
问题在于,我的工作方式仅是获得调解图表。我当前的图形如下所示:
我的代码如下所示:
.gitignore
数据如下:
此link包含数据
答案 0 :(得分:0)
您可以使用熔体来重塑DataFrame
df_ = df[['Concurrent Users', '90th Percentile of Response Time (ms)',
'95th Percentile of Response Time (ms)', '98th Percentile of Response Time (ms)',
'99th Percentile of Response Time (ms)', '99.9th Percentile of Response Time (ms)']].melt('Concurrent Users')
并在hue
中使用barplot
参数
fig, ax = plt.subplots()
sns.barplot(x='Concurrent Users', y='value', hue=0, data=df_, ax=ax)
新的DataFrame df_
如下所示:
Concurrent Users 0 value
0 50 90th Percentile of Response Time (ms) 26
1 100 90th Percentile of Response Time (ms) 51
2 200 90th Percentile of Response Time (ms) 105
3 300 90th Percentile of Response Time (ms) 158
4 500 90th Percentile of Response Time (ms) 243
并且有这些dtypes
Concurrent Users int64
0 object
value int64
答案 1 :(得分:0)