No idea how to get my scatter plot to talk to my colorbar. I have taken endless approaches and consulted every forum all to no avail. I am either very close or nowhere near, surly this should only be a one or two liner?? Please help.
import matplotlib.colors as cols
import matplotlib.cm as cm
import matplotlib.pylab as plt
norm=cols.Normalize(clip=False,vmin=-0.2,vmax=0.2)
sc=plt.scatter(alph,delt,edgecolor='none',s=5,cmap=plt.cm.get_cmap('RdYBlu',norm=norm,vmin=-0.2,vmax=0.2)
m=plt.cm.ScalarMappable(cmap=sc.map,norm=sc.norm)
m.set_array(dmag)
plt.colorbar(m)
alph and delt are numpy arrays of x and y coordinates, while dmag is numpy array of floats in the interval approx. [-0.6,0.8]. The result of running this cose is a scatter plot of black points alongside a colour bar ranging from -0.6 to 0.8. I want the scattered points to be colored according to values in dmag in the range -0.2 to 0.2 and want the colorbar over the range -0.2 to 0.2. I want the range -0.2 to 0.2 to reflect the entire colormap.
Thanks jrf.