xlabels do not show up with seaborn and tight despined layout in python
<p>I would like to plot the following dataframe with xtick labels rotated while also having a tight, despined layout (using <code>tight_layout()</code> from matplotlib and <code>despine</code> from seaborn). the following does not work because the labels do not show up:</p>

<pre><code>import matplotlib.pylab as plt
import seaborn as sns
import pandas
df = pandas.DataFrame({"x": ["XYZ1", "XYZ2", "XYZ3", "XYZ4"],
                       "y": [0, 1, 0, 1]})
plt.figure(figsize=(5,5))
sns.set_style("ticks")
g = sns.pointplot(x="x", y="y", data=df)
sns.despine(trim=True, offset=2)
g.set_xticklabels(g.get_xticklabels(), rotation=55, ha="center")
plt.tight_layout()
</code></pre>

<p>it produces:</p>

<p><a href="http://i.stack.imgur.com/2aWKs.png" rel="nofollow"><img src="http://i.stack.imgur.com/2aWKs.png" alt="enter image description here"></a></p>

<p>the xtick labels ("XYZ1", "XYZ2", ...) do not appear. if i remove despine the ticks appear but then not despined. if i change ticks before despine/tight_layout, they appear but are not rotated. how can this be done? </p>

<p>on my machine the following works</p>

<pre><code>import matplotlib.pylab as plt
import seaborn as sns
import pandas
df = pandas.DataFrame({"x": ["XYZ1", "XYZ2", "XYZ3", "XYZ4"],
                       "y": [0, 1, 0, 1]})
plt.figure(figsize=(5,5))
sns.set_style("ticks")
g = sns.pointplot(x="x", y="y", data=df)
sns.despine(trim=True, offset=2)
g.set_xticklabels(df['x'], rotation=55, ha="center")
plt.tight_layout()
plt.show()
</code></pre>

<p>and produces</p>

<p><a href="http://i.stack.imgur.com/e2avf.png" rel="nofollow"><img src="http://i.stack.imgur.com/e2avf.png" alt="enter image description here"></a></p>

python matplotlib seaborn