Skip to content Skip to sidebar Skip to footer

How Can I Adjust The Spacing Between Labels In A Factorplot In Seaborn

I've been thoroughly enjoying the amazing combination of Pandas and Seaborn for my data analysis and plotting needs. It's been enough to prevent me from going down the path of lea

Solution 1:

These are just matplotlib axis ticklabels at integral positions. So you could do

df = pd.DataFrame(dict(x=np.repeat(np.arange(21), 10), y=np.random.randn(210)))
df.loc[df.x == 20, "x"] = ">= 20"

g = sns.factorplot(x="x", y="y", data=df, kind="box")
g.axes[0, 0].set_xticks(range(20) + [20.5])

enter image description here

(Note that version version 0.6+ has an ax attribute on single-axes FacetGrid objects that will make accessing the methods a bit easier)


Post a Comment for "How Can I Adjust The Spacing Between Labels In A Factorplot In Seaborn"