Skip to content

Instantly share code, notes, and snippets.

@kghose
Created July 25, 2011 18:35
Show Gist options
  • Save kghose/1104821 to your computer and use it in GitHub Desktop.
Save kghose/1104821 to your computer and use it in GitHub Desktop.
Code to make pretty looking axes ready for plotting, using matplotlib
def pretty_axes(ax):
"""ax is a matplotlib axis instance."""
ax.spines['left'].set_position('zero')
ax.spines['bottom'].set_position('zero')
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
for tick in ax.xaxis.get_major_ticks():
tick.tick2On = False
for tick in ax.yaxis.get_major_ticks():
tick.tick2On = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment