Skip to content

Instantly share code, notes, and snippets.

@mandli
Last active August 29, 2015 14:07
Show Gist options
  • Save mandli/9c4a831f00249ee31035 to your computer and use it in GitHub Desktop.
Save mandli/9c4a831f00249ee31035 to your computer and use it in GitHub Desktop.
Demo of tick label rotation
#!/usr/bin/env python
import numpy
import matplotlib.pyplot as plt
X, Y = numpy.meshgrid(numpy.linspace(-2, 2, 200, numpy.linspace(-2 ,2 ,20))
fig = plt.figure(figsize=[16,8])
axes = []
for n in xrange(2):
axes.append(fig.add_subplot(1, 2, n + 1))
axes[n].pcolor(X, Y, X*Y)
axes[n].set_xlim(-1,1)
axes[n].set_ylim(-1,1)
labels = axes[0].get_xticks().tolist()
axes[0].set_xticklabels(labels, rotation=30)
for label in axes[1].get_xticklabels():
label.set_rotation(30)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment