Cleanest way to hide every nth tick label in matplotlib colorbar?

For loop the ticklabels, and call set_visible():

for label in cbar.ax.xaxis.get_ticklabels()[::2]:
    label.set_visible(False)

Leave a Comment