Pterosaur Pterosaur - 1 year ago 111
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?

Answer Source

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.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download