On Mon, Oct 31, 2011 at 11:02 AM, Tommy Grav <firstname.lastname@example.org> wrote:
I have been looking around but can't find what I want.
I have two arrays, one with numbers from 0.02 to 0.20 and
the other from 0.03 to 0.50. I am trying to plot them together
with other arrays in a scatterplot where these two are the
but it seems that each instance of the plot command rescales
the array such that myarr1.max() and myarr2.max() are both with,
which means that the two color scales are out of sync. Is there
a way to force the two plots to respect the values in the array
have the cmap go from 0 to 1, not from myarr1.min() to myarr1.max()?
The general method is to use a Normalize object and pass it as kwarg 'norm'. However, as a convenience, some plotting functions has a 'vmin' and 'vmax' kwarg that can be specified:
plt.scatter(x1,y1,c=myarr1,cmap=plt.get_cmap("gist_heat), vmin=0.0, vmax=1.0)
plt.scatter(x2,y2,c=myarr2,cmap=plt.get_cmap("gist_heat), vmin=0.0, vmax=1.0)