Suleka_28
Suleka_28

Reputation: 2919

How to draw multiple plots with seaborn factorplot?

I have dataframe as:

enter image description here

I want to create a factorplot using seaborn as shown below: enter image description here

The data is here.

Note: Sleep time in the sown graph = Back-end Service Delay (ms)

My existing code is shown below, I do not know how to proceed with it. Any help is much appreciated.

def save_multi_columns_categorical_charts(df):
   )
    # add_chart_details(title, filename)
    fig, ax = plt.subplots()
    all_columns = df['Throughput (Requests/sec'),'Back-end Service Delay (ms)', 'Concurrent Users','Scenario Name','Message Size (Bytes)']

Upvotes: 0

Views: 881

Answers (1)

Suleka_28
Suleka_28

Reputation: 2919

Basically, what I had to do was use melt:

df_results = df_results.melt(id_vars=['Concurrent Users', col,'Scenario Name','Back-end Service Delay (ms)'],
                        value_vars=['Throughput (Requests/sec)'])

df_results['new_var'] = df_results[col] + ' - ' + df_results['Scenario Name']

g = sns.factorplot(x="Concurrent Users", y='value',
                           hue='new_var', col='Back-end Service Delay (ms)',
                           data=df_results, kind=kind,
                           size=5, aspect=1, col_wrap=2, legend=False)

Upvotes: 1

Related Questions