I have a few graphs I made with seaborn
. I plot boxplots and other things by certain groups. I'll give you an example to illustrate:
As you can see, the x-lables are too long. I rotated them by 90 degrees just to make them readable. I could go and change the category names manually. However, I need to perform this task weekly - and the categories change over time. Do you have any good idea how to solve this issue?
For good measure, I'll give you what I have done so far. Given a figitive dataset, this is basically what I do with my pandas dataframe df
:
rank sentiment category
0 1 0.657413 super_long_string
1 2 0.895769 super_long_string
2 3 -0.435457 super_long_string
3 4 -0.717959 other_super_long_string
4 5 0.869688 other_super_long_string
ax =sns.boxplot(x='category', y=sentiment, data=df);
ax.set_xticklabels(ax.get_xticklabels(),rotation=90)
plt.figure()
Is there a way to strip a way the long x-axis lables without losing the info? My idea is to keep the labels in a legend. Maybe similar to this example? Is that possible with seaborn, and if so how?
Any ideas? Thank you very much in advance!