I've noticed on the matplotlib examples gallery that all of their plots featuring vertical colorbars have tick marks on them that face inward,
(i.e. From the edge of the bar into the colored region of the bar).
For the types of plots and colorscales that I am using, it would be much better to have the tick marks facing outwards.
How would I modify this simple example from the matplotlib gallery (see below) to have outward facing tick marks on its colorbar?
from matplotlib.colors import LogNorm
from pylab import *
#normal distribution center at x=0 and y=5
x = randn(100000)
y = randn(100000)+5
hist2d(x, y, bins=40, norm=LogNorm())
colorbar()
show()
Simply set the tick_params
for the colorbar:
from matplotlib.colors import LogNorm
from pylab import *
#normal distribution center at x=0 and y=5
x = randn(100000)
y = randn(100000)+5
hist2d(x, y, bins=40, norm=LogNorm())
colorbar().ax.tick_params(axis='y', direction='out')
show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With