I have a data frame as shown below:
I want to structure it in a way that I will be able to plot a bar chart as shown below:
The data is here.
You want to melt
and then use a barplot with hue
:
import seaborn as sns
small_data = df_results[[ 'Scenario Name','Concurrent Users', '90th Percentile of Response Time (ms)',
'95th Percentile of Response Time (ms)','99th Percentile of Response Time (ms)']]
small_data = small_data.melt(id_vars=['Scenario Name', 'Concurrent Users'])
small_data['new_var'] = small_data.variable + ' - ' + small_data['Scenario Name']
g = sns.barplot(x="Concurrent Users", y="value", hue='new_var', data=small_data)
sns.set(rc={'figure.figsize':(11,8)})
Output:
To save use
fig = g.get_figure()
fig.savefig(filename)
And just wrap all that in a function.