pythonmatplotlibseabornx-axis

Rotate label text in seaborn


I have a simple factorplot

import seaborn as sns
g = sns.factorplot("name", "miss_ratio", "policy", dodge=.2, 
    linestyles=["none", "none", "none", "none"], data=df[df["level"] == 2])

enter image description here

The problem is that the x labels all run together, making them unreadable. How do you rotate the text so that the labels are readable?


Solution

  • You can rotate tick labels with the tick_params method on matplotlib Axes objects. To provide a specific example:

    ax.tick_params(axis='x', rotation=90)