I am a new in Python. Could you please help me to make a proper customization of the colorbar. I've already tried several variants from the web, but they don't work in proper way. I have the following graph with colorbar:
Here is the code:
set_cmap('rainbow')
contourf(0.5*(data1+data2))
xlabel (r'across track $\rm\,[pixels]$')
ylabel (r'along track $\rm\,[pixels]$')
cbar = plt.colorbar()
cbar.set_label('radiance', rotation=270)
title('1.6 mue (avg: 5992-6012 cm^(-1))')
# Show the major grid lines
plt.grid(b=True, which='major', color='#666666', linestyle='-')
# Show the minor grid lines
plt.minorticks_on()
plt.grid(b=True, which='minor', color='#666666', linestyle='-', alpha=0.4)`fig=plt.figure()
I need to truncate my colorbar to the values from 0 to 9, i.e. 0,1,2,3,4,5,6,7,8,9 and create a new color for each of the value.
P.S. Commands like cbar = plt.clim(0, 9) are not working.
Thanks in advance!

