Created
July 25, 2011 18:35
-
-
Save kghose/1104821 to your computer and use it in GitHub Desktop.
Code to make pretty looking axes ready for plotting, using matplotlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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