Hi,
I have a pandas dataframe with about 15000 rows and 7 columns of numerical data and 1 column of categorical data. The categorical data column has 3 categories - βloβ, βmedβ and βhiβ.
I am trying to plot boxplots using Plotly.
The code I am using is:
traces = [ ]
for param in df.columns:
if param != 'category':
traces.append(go.Box(y=df[param], name=param, x=df['category']))
layout = go.Layout(showlegend=True, boxmode='group')
fig = go.Figure(traces, layout)
fig.update_xaxes(categoryorder='array', categoryarray=['lo', 'med', 'hi'])
fig
This produces the output below:
However, I would like to group the plots as follows:
outer level: column names
inner level: category
I would appreciate any help in customising the code to achieve this.
Many thanks