1

I would like to fix label problems in a seaborn graph, I have more than 30 items in the x axis. How to reduce the label dimension or may be rotate the graph?

enter image description here

import seaborn as sns g = sns.factorplot(x="target", data=df3, kind="count", palette="BuPu", size=6, aspect=1.5) 
4
  • Are you after plt.xticks(rotation=90)? (where import matplotlib.pylab as plt) Commented Jan 10, 2017 at 16:45
  • You can also try: g.set(xticks=np.arange(0, N, 3)) to show only every third label. Commented Jan 10, 2017 at 16:47
  • I have added both import matplotlib.pylab as plt and the other statement (plt.xticks(rotation=90) but nothing changes....may os it in any particular order? Commented Jan 10, 2017 at 16:58
  • What environment do you work in? Commented Jan 10, 2017 at 17:03

1 Answer 1

2

This will work if executed in a single cell in Jupyter:

g = sns.factorplot(x="target", data=df3, kind="count", palette="BuPu", size=6, aspect=1.5) g.set(xticks=np.arange(0, 40, 3)) # or however many you have plt.xticks(rotation=90); 

It will also work if executed as one block in Spyder.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.