Skip to content

Commit

Permalink
Change violin plot orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
nictru committed Mar 1, 2024
1 parent 583a151 commit 795bfd0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ def plot_violines():

for i, (col, pretty_name) in enumerate(pretty_names.items()):
ax = axes[i // n_cols, i % n_cols] if n_rows > 1 else axes[i]
sns.violinplot(adata.obs[col], ax=ax)
sns.violinplot(x=adata.obs[col], ax=ax)
ax.set_xlabel(pretty_name)
ax.set_ylabel('Density')

current_distribution = distributions[col]

# Add horizontal line for median
ax.axhline(current_distribution['median'], color='r', linestyle='--')
ax.axvline(current_distribution['median'], color='r', linestyle='--')

for mads in [1, 2, 3]:
ax.axhline(min(current_distribution['median'] + mads * current_distribution['std'], current_distribution['max']), color='g', linestyle=':')
ax.axhline(max(current_distribution['median'] - mads * current_distribution['std'], current_distribution['min']), color='g', linestyle=':')
ax.axvline(min(current_distribution['median'] + mads * current_distribution['std'], current_distribution['max']), color='g', linestyle=':')
ax.axvline(max(current_distribution['median'] - mads * current_distribution['std'], current_distribution['min']), color='g', linestyle=':')

return fig

0 comments on commit 795bfd0

Please sign in to comment.