Answers for "colorbar matplotlib"

0

legend of colorbar python

cbar = plt.colorbar()
cbar.ax.set_yticklabels(['0','1','2','>3'])
cbar.set_label('Numbers', rotation=270)
Posted by: Guest on April-10-2020
0

colouring bar plot python matplotlib

import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import Normalize
from numpy.random import rand
 
data = [2, 3, 5, 6, 8, 12, 7, 5]
fig, ax = plt.subplots(1, 1)
 
# Get a color map
my_cmap = cm.get_cmap('jet')
 
# Get normalize function (takes data in range [vmin, vmax] -> [0, 1])
my_norm = Normalize(vmin=0, vmax=8)
 
ax.bar(range(8), rand(8), color=my_cmap(my_norm(data)))
plt.show()
 
<div class="open_grepper_editor" title="Edit & Save To Grepper"></div>
Posted by: Guest on June-08-2021
-2

add colorbar matplotlib

import matplotlib.pyplot as plt

plt.figure()
m = create_map()
plt.scatter(*positions[::-1],c=count_vec)
plt.colorbar()
plt.show()
Posted by: Guest on July-13-2020

Python Answers by Framework

Browse Popular Code Answers by Language