colorbar matplotlib code example
Example 1: legend of colorbar python
cbar = plt.colorbar()
cbar.ax.set_yticklabels(['0','1','2','>3'])
cbar.set_label('Numbers', rotation=270)
Example 2: matplotlib color
Alias Color
'b' blue
'g' green
'r' red
'c' cyan
'm' magenta
'y' yellow
'k' black
'w' white
Example 3: add colorbar matplotlib
import matplotlib.pyplot as plt
plt.figure()
m = create_map()
plt.scatter(*positions[::-1],c=count_vec)
plt.colorbar()
plt.show()