我想制作一个色标,使其勾号指向内。但是,当我将刻度线的方向设置为“ in”时,刻度线绘制在颜色栏下方,几乎不可见。我该怎么做才能将它们绘制在颜色栏的顶部?
from matplotlib import pyplot as plt
from matplotlib import cm
norm = plt.Normalize(0, 100)
sm = plt.cm.ScalarMappable(cmap="Purples", norm=norm)
sm.set_array([])
fig, ax = plt.subplots(figsize=(10,10))
cbar = ax.figure.colorbar(sm)
cbar.outline.set_visible(False)
cbar.ax.yaxis.set_ticks_position('both')
cbar.ax.tick_params(labelsize=20, color='k')
from matplotlib import pyplot as plt
from matplotlib import cm
norm = plt.Normalize(0, 100)
sm = plt.cm.ScalarMappable(cmap="Purples", norm=norm)
sm.set_array([])
fig, ax = plt.subplots(figsize=(10,10))
cbar = ax.figure.colorbar(sm)
cbar.outline.set_visible(False)
cbar.ax.yaxis.set_ticks_position('both')
cbar.ax.tick_params(labelsize=20, color='k', direction='in')