I am plotting 6 arrows at specific coordinates. How do I render colors to these arrows based on the array V? The values are to be assigned according to the expected output.
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
import matplotlib.colors as colors
from matplotlib import cm
V=np.array([[10],[20],[30],[40],[50],[60]])
cmap = plt.cm.jet
cNorm = colors.Normalize(vmin=np.min(V), vmax=np.max(V))
scalarMap = cm.ScalarMappable(norm=cNorm,cmap=cmap)
fig = plt.figure()
ax = fig.add_axes([0.1, 0.1, 0.7, 0.855]) # [left, bottom, width, height]
axc = fig.add_axes([0.85, 0.10, 0.05, 0.85])
for idx in range(0,len(V)):
colorVal = scalarMap.to_rgba(V[idx])
ax.arrow(200, 400, -50, -50,width=5, head_length=20, fc='k',ec='k')
ax.arrow(200, 400, 50, -50, width=5, head_length=20, fc='k', ec='k')
ax.arrow(200, 400, 0, -50, width=5, head_length=20, fc='k', ec='k')
ax.arrow(200, 300, 50, 0, width=5, head_length=20, fc='k', ec='k')
ax.arrow(200, 300, 50, -50, width=5, head_length=20, fc='k', ec='k')
ax.arrow(400, 300, -50, -50, width=5, head_length=20, fc='k', ec='k')
cb1 = mpl.colorbar.ColorbarBase(axc, cmap=cmap,
norm=cNorm,orientation='vertical')
ax.set_xlim(left = 0, right = 500)
ax.set_ylim(bottom = 0, top = 500)
plt.show()
The current output is
The expected output is


