Huey Huey - 1 year ago 150
Python Question

Remove some x labels with Seaborn

In the screenshot below, all my x-labels are overlapping each other.

g = sns.factorplot(x='Age', y='PassengerId', hue='Survived', col='Sex', kind='strip', data=train);

I know that I can remove all the labels by calling
, but is there a way to just show some of the Age labels, like 0, 20, 40, 60, 80?

enter image description here

Answer Source

I am not sure why there aren't sensible default ticks and values like there are on the y-axis. At any rate you can do something like the following:

import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

titanic = sns.load_dataset('titanic')
ax = plt.gca()


enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download