colorbar remove tick lines and border 1

colorbar remove tick lines and border

f = plt.figure()
ax = f.add_subplot(1,1,1)
mat = np.arange(100).reshape((10, 10))
i = ax.imshow(mat, cmap= 'viridis')
cb = f.colorbar(i)
cb.ax.tick_params(size=0) #Remove ticks
cb.outline.set_visible(False) #Remove outline

Here is what the above code is Doing:
1. Create a figure and add an axis to it.
2. Create a matrix of numbers and plot it as an image.
3. Add a colorbar to the figure.
4. Remove the ticks from the colorbar.
5. Remove the outline from the colorbar.

Similar Posts