[ncl-talk] How to coincide zero with the white color of the colo bar with uneven numbering

Dennis Shea shea at ucar.edu
Thu Nov 13 08:43:28 MST 2014


A correction for [1]

                                               ; 17 colors
  res at cnFillPalette        = (/ 2,10,18,26,34,42,50,58, 66, 74, 82, 90
\    ; blues
                              ,127 \             ; white [also, 0
                              ,146,162,194,242/) ; yellow, red

should be

                                                 ; 17 colors
  res at cnFillColors        = (/ 2,10,18,26,34,42,50,58, 66, 74, 82, 90
\    ; blues
                              ,127 \             ; white [also, 0]
                              ,146,162,194,242/) ; yellow, red

========

Also, can can repeat index values. so -0.2, 0.0, 0.2  could be referenced
to 127, 127,127   [or, 0,0,0]

On Thu, Nov 13, 2014 at 7:49 AM, Dennis Shea <shea at ucar.edu> wrote:

> These are not appropriate for what you want to do. Remove them.
>
>   res at gsnSpreadColors  =  True
>   res at gsnSpreadColorStart = -1
>   res at gsnSpreadColorEnd  = 2
>
> ===
> There are two common approaches. Both require use of the 'ExplicitLevels'
>
> [1]
> Indexing from a specific color table. For example:
>
> http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml#White-in-the-middle
>
>    gsn_define_colormap(wks, "BlueWhiteOrangeRed")        ; user specified
>
>   res at cnLevelSelectionMode = "ExplicitLevels"
>   res at cnLevels             = fspan(-2, 1, 16)    ; 16 contour levels
>                                                  ; 17 colors
>   res at cnFillPalette        = (/ 2,10,18,26,34,42,50,58, 66, 74, 82, 90 \    ; blues
>                               ,127 \             ; white [also, 0
>                               ,146,162,194,242/) ; yellow, red
>
> The above may not be quite what you want but it gives you the idea.
>
> ---
> You can force 'white' (background color) into *any* color scheme. by using
> index 0 which is the
> background color (white)
>
>
> [2]
> Named colors.
> The  following are not the -2 to 1 @ 0.2 you mentioned. They are for
> unequally spaced contours
> but you get the idea. This
>
>   res at cnLevelSelectionMode = "ExplicitLevels"
>   res at cnLevels             = (/0.1,1,2.5,5,10,15,20,25,50,75/) ;   ; 10 contour values
>   res at cnFillPalette        = (/"Snow","PaleTurquoise","PaleGreen"\ ; 11 contour colors
>                               ,"SeaGreen3" ,"Yellow","Orange"    \
>                               ,"HotPink","Orange","HotPink","Red"\
>                               ,"Violet", "Purple", "Brown"       /)
>
>
>
> On Thu, Nov 13, 2014 at 5:43 AM, mamadoulamine.mbaye at ucad.edu.sn <
> mamadoulamine.mbaye at ucad.edu.sn> wrote:
>
>>  Hi Tirkey,
>>
>> You can use   res at cnFillColors   = (/put the numbers corresponding of
>> the desired color:
>>
>>
>> https://www.ncl.ucar.edu/Document/Graphics/ColorTables/BlueWhiteOrangeRed.shtml
>> /)
>>
>> Each color should has a number
>>
>> Hope this helps!
>>
>> Mamadou,
>>
>> Regards
>>
>>
>>
>>
>>
>>
>>  ------------------------------
>> *De :* ncl-talk-bounces at ucar.edu <ncl-talk-bounces at ucar.edu> de la part
>> de snehlata Tirkey <snehlata_tirkey at yahoo.com>
>> *Envoyé :* jeudi 13 novembre 2014 04:24
>> *À :* ncl-talk at ucar.edu
>> *Objet :* [ncl-talk] How to coincide zero with the white color of the
>> colo bar with uneven numbering
>>
>>   Hello NCL users,
>>
>>  I am trying to plot a color plot with a color bar of range -1 to 2 with
>> an interval of 0.2 by using-
>>
>>    wks = gsn_open_wks("ps","MSE_0.5")
>>   gsn_define_colormap(wks,"BlueWhiteOrangeRed")
>>
>>   res               =  True
>>   res at gsnMaximize      =  True
>>   res at gsnAddCyclic     =  False
>>   res at cnFillOn           =  True
>>   res at gsnSpreadColors  =  True
>>   res at gsnSpreadColorStart = -1
>>   res at gsnSpreadColorEnd  = 2
>>   res at trXMinF        = 11
>>   res at trXMaxF        = 27
>>   res at cnLevelSelectionMode =  "ManualLevels"
>>   res at cnLevelSpacingF    = 0.2
>>   res at cnMinLevelValF   =  -1
>>   res at cnMaxLevelValF    = 2
>>
>> I want '0' to coincide with the white of the bar but it is coinciding
>> with the yellow. Please help.
>>
>>  Thanking in anticipation.
>>
>>   Yours sincerely,
>> Snehlata Tirkey
>> e-mail: snehlata_tirkey at yahoo.com
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141113/fcaeddc3/attachment.html 


More information about the ncl-talk mailing list