Pterosaur Pterosaur - 17 days ago 7x
Python Question

Hide upper/right tick markers using rcparams/mplstyle

I am currently using a variant of this answer to eliminate the top/right edges on my plots. However, I would like to be able to add this to my .mplstyle file instead of calling this function for every plot I create. Is there a way to achieve this functionality using the style parameters, or even by calling something once at the beginning of my code?


You can use: : False
axes.spines.right : False

in a mpstyle file to turn off spines. Unfortunately, this recent answer indicates that ticks cannot currently be controlled from an rc or style file like this, and I haven't yet found a way either. However, in matplotlib 2.0 you should be able to write: : False
ytick.right : False

(In fact, this appears to be the default style for 2.0, according to the template file.)