I want to create a violin plot for my data, which are measurements of cell size.
I have collected my data:
3 different time points: 24, 48 and 72h.
2 different conditions: untreated and treated.
Now, I want to plot a split violin plot based on a staining I did on my cells, either low or high.
- y-axis: Cell area µm2
- x-axis: Time (24, 48, 72h)
- Condition: untreated, treated.
Each violin plot is split:
- left side: low
- right side: high
Currently, I get this graph: result_graph
Which has combined the data for 'Condition' as I can't seem to separate the x-axis on 'Time' and 'Condition'.
My Code for the graph:
import seaborn as sns
k = 1
fnt= 8
plt.clf()
sns.set_context('paper')
sns.set(font_scale=1.5)
sns.set_style('ticks')
plt.figure(0,(4,5),dpi=300)
plt.title('Cell size after NCS treatment')
custom_palette = {'CDK low': '#a6dba0', 'CDK high': '#008837'}
ax = sns.violinplot(data=tidy_df,x='Time',y='value',hue='CDK status',
order=plot_order,
hue_order=['CDK low', 'CDK high'],
split=True,gap=0,
palette=custom_palette,
alpha=0.9,
linewidth=0.5,
edgecolor='black',
inner='quartile',
width=0.8,
dodge=True
)
I tried to generate the plot using catplot kind=violin
but this did not work either, because I could only separate it by making two separate graphs using col='Condition'
Can I somehow separate the Time and Condition on the x-axis?