From: Phillip M. F. <pfe...@ve...> - 2009-10-10 03:06:22
|
I'm not sure whether I'm correctly understanding you. Let's consider a hypothetical engineering performance-versus-requirements scatter plot or contour plot of a performance metric that takes positive values. I'd like to map values to colors so that anything below 50 gets solid red, values from 50 to 70 get a color between red and orange (linear interpolation), values from 70 to 90 get a color between orange and yellow, values from 90 to 105 get a color between yellow and green, and anything greater than or equal to 105 gets solid green. Is this considered "smooth variation"? If so, how would I implement something like this? Thanks! Phillip Eric Firing wrote: > Phillip M. Feldman wrote: >> Eric and Reinier- >> >> It seems to me that continuous (piecewise-linear) colormaps could >> work in much the same fashion. One would specify n boundary colors >> and n thresholds (for continuous colormaps, I believe that the number >> of thresholds and colors must be the same), and for any value between >> two thresholds, the colors associated with the bounding thresholds >> would be automatically interpolated. What do you think? > > How does this differ from LinearSegmentedColormap.from_list()? I > guess what you are getting at is the quantization problem I mentioned > in connection with discrete colormaps. But it is not a problem when > the colors are linearly interpolated--that is, smoothly varying from > one end of the map to the other. It is only a problem when there are > jumps. > > Eric > >> >> Phillip >> >> Eric Firing wrote: >>> What does allow you to specify the transitions exactly (to within >>> the limits of double precision) is this: >>> >>> cmap = ListedColormap(['r','g','b']) >>> norm = BoundaryNorm([1.5+1.0/3, 1.5+2.0/3], cmap.N) >> > > |