Custom xticks for multiple subplots?
<p>Using Matplotlib, I have two subplots and I want them to have the same custom string xticks.</p>

<p>Here is a minimal example what I tried so far:</p>

<pre><code>import matplotlib.pyplot as plt
f, axs = plt.subplots(ncols=2, sharex=True)
plt.xticks(range(6), [str(x)+"foo" for x in range(6)], rotation='45')
for i in range(2):
    ax = axs[i]
    ax.plot(range(6), range(6))
f.show()
</code></pre>

<p>Produces this output:</p>

<p><a href="https://i.stack.imgur.com/vIrfr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vIrfr.png" alt="output of code example"></a></p>

<p>Note that the xticks on the left are <em>not</em> rotated. How can I do that?</p>

<p>If I remove the <code>sharex=True</code>, the left subplot has no custom xticks. However, I cannot give xticks to a single axis. It results in an error:</p>

<pre><code>AttributeError: 'AxesSubplot' object has no attribute 'xticks'
</code></pre>