[Thread Prev][Thread Next][Index]

Re: [ferret_users] Custom colorbar/ Multiple Palettes



Hi Ashley,
           For CONTOUR colors, such a color scheme can be achieved
directly with the /LEVLES qualifier (see User Manual Ch6 Sec8.1.1).
For fill/shade command, I think there isn't any such easy methods.
Instead User Manual provided some methods to create/edit palette
files (Ref Sec20.  PALETTE) to achieve the desired color scheme.
(Also see Ch6 Sec5.2.  Shade and fill colors.)

  Here is a method to create a palette file manually. Your requirement 
is :
         red   color from -120 to -20
         white color from -20  to  20
         blue  color from  20  to 120

Now, the important step here is to get proper percentage values (first
column in a palette *.spk file). Though there are mainly 3-color ranges,
we need to add two more, one about -20 and one about 20 to have abrupt
color change about these values (otherwise the color will vary gradually). 
Let us fix -20.05 as the value where red color should end and -20.00 as 
the value where white color should start (similarly for the +ve side too).
Then do the following in Ferret :

  let col_bnds   = XSEQUENCE({-120.00,-20.05,-20.00,20.00,20.05,120.00})
  let val_length =  240  ! max-min --> 120-(-120) = 240
  let val_zero   = -120  ! min --> value corresponding to 0%
  let percentage = 100*(col_bnds-val_zero)/val_length 

  set list/precision=7
  list percentage

Save the output of above list command to a text file with .spk extension
(eg. red_white_blue.spk) and type in the rgb values for each percentage
entries. For the desired red-white-blue color scheme, the entries in the
spk file will be as follows :

      0.0000  100    0    0
     41.6458  100    0    0
     41.6667  100  100  100
     58.3333  100  100  100 
     58.3542    0    0  100
    100.0000    0    0  100

You can use this new spk file, but with a levels qualifier (whatever may
the the delta value for levels qualifier, this palette will always behave 
in the same manner) as :

 case 1:  FILL/pal=red_white_blue/LEVELS=(-120,120,20)  variable

or (if you want single label per color, then)

 case 2:  FILL/pal=red_white_blue/LEVELS="(-120,-20,100),(-20,20,40),(20,120,100)"    

If you intend to use a multiple levels as in case 2, then you can easily
define a palette file with the following entries

      0.0000  100    0    0
     33.3333  100  100  100 
     66.6666  100  100  100 
    100.0000    0    0  100

But, with this palette file, the color scheme will depend on the "delta" 
value specified to the /LEVELS qualifier. Try to see it.

Once you finalize the spk file, you can place it in your ferret/ppl 
directory so that you can access it from any location on your machine.

Please let me know if you have any questions.

Regards,

Jaison


On Tue, 29 May 2007, Ashley Watson wrote:

> Hi ferreters,
> 
>     I want to specify multiple palettes for my shade plot. My data values
> are in the range -120 to 120.
>  All I want to do is to define different colors for my plot. For example, I
> want to specify white color (or no color)
> for values -20 to 20,  and Blue palette for positive values (20 to 120) and
> Red palette for negative values.(-20 to -120).
>  How can I make such plot?
> 
> Ashley
> 
> 


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement