Re: How to plot multiple cgContour plots using the same colour levels (but containing differing data) [message #76399 is a reply to message #76398] |
Mon, 30 May 2011 20:25   |
manodeep@gmail.com
Messages: 33 Registered: June 2006
|
Member |
|
|
On May 30, 9:20 pm, Balt <bindermue...@gmail.com> wrote:
> Well, since by clipping to less than the max value I'm always going to
> be below the max color palette entry, out of bounds should not be a
> condition that ever occurs?
>
> Chees
>
> - Balt
The way I have done it in the past is by getting the global (min,max)
of all the data sets. The global min corresponds to color 0 and the
global max to color 255. Now you have to scale the individual data
sets:
Ncolors = 255
data_color_range = (data_max-data_min)/(global_max-
global_min)*Ncolors
data_color_max = (data_max/global_max*Ncolors) < Ncolors
data_color_min = (data_color_max - data_color_range) > 0
data = byte(scale_vector(data,data_color_min,data_color_max))
...rinse, repeat for each data set.
The colorbar can then plotted as usual ranging from global_min to
global_max in data space and 0-Ncolors in color space.
Cheers,
Manodeep
|
|
|