[ncl-talk] unsymetrical non linear colormaps for plots
Mary Haley
haley at ucar.edu
Fri Aug 17 09:33:13 MDT 2018
Hi Sri,
I'm not an expert on what colors to use to best fit your data, as it really
depends from person to person what you are trying to accomplish.
You have the right idea by explicitly setting your own color levels and
then choosing individual colors to go with each level.
One way you can make some colors stand out more than others is by using an
RGBA array to define your colors, and then you can control the opacity of
each color. I've attached an example script and the panel image where the
last few colors are made more transparent, causing the lower contours to
stand out more.
Another method is if you are trying to avoid color maps with green in them,
then go to our color table gallery:
http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml
and browse the various color maps. You could look at some of the smaller
color maps because then you can pick out colors that you like and don't
like. Each of these color maps has an RGB file associated with it, so you
could also pick out the RGB colors that you like and mix and match RGB
triplets.
For example, if you look at the "lithology" color table:
http://www.ncl.ucar.edu/Document/Graphics/ColorTables/lithology.shtml
and click on the "lithology.rgb" link you will see the RGB triplets. You
can then select the colors you like and get the RGB value for that color.
You can then set the color contours with:
res at cnFillPalette = (/
(/253,244,63/),(/224,197,158/),(/191,167,67/),(/184,234,295/)/) / 255.
Notice that you need to divide by 255 to get values from 0 to 1.
As a debugging tool, use "draw_color_palette" to draw a set of colors if
you want to see what they look like. You can then tweak them as necessary.
For example:
wks = gsn_open_wks("x11","rgb")
colors = (/(/253,244,63/), \
(/224,197,158/), \
(/191,167,67/), \
(/232,28,0/), \
(/110,73,9/), \
(/107,195,255/), \
(/129,3,255/)/) / 255.
draw_color_palette(wks,colors,False)
creates the attached "rgb.000001.png" file. I've attached a
"draw_my_colors.ncl" script that shows how to also draw the RGBA colors
with transparency applied.
I know this doesn't directly answer your question about what colors to use,
but hopefully this gives you an idea of various methods you can use for
selecting colors and tweaking them.
--Mary
On Fri, Aug 17, 2018 at 7:48 AM, Sri Nandini <snandini at marum.de> wrote:
> On Aug 17, 2018 3:45:01 PM, Sri Nandini wrote:
>
> Hello
>
> I am plotting a simple mean evaporation panel plot with extreme values. As
> such i decided to use a non linear color scale for this to try to focus on
> the smaller changes and use white to "mask" the larger variability because
> that's not important and i want the reader to focus on the smaller changes.
>
> But i cannot seem to really distribute a good color scheme to highlight
> the smaller changes reasonably and i am trying to not use green. I think it
> becomes clearer once you view the attached plot. I have attached the
> plotting resources used in my script below.
> I have tried to change the ExplicitLevels values many times as well as the
> ;res at cnFillPalette = (/"Snow","Black","Blue","
> PaleTurquoise","PaleGreen","SeaGreen3" ,"Yellow","Pink","Red","Orange","Brown"/)
> colors = (/"white", "black", "PeachPuff", "MintCream", "SlateBlue", \
> ; "Khaki", "OliveDrab","BurlyWood", "LightSalmon", "Coral", \
> ; "HotPink", "LemonChiffon", "AliceBlue", "LightGrey", \
> ; "MediumTurquoise", "DarkSeaGreen", "Peru", "Tomato", \
> ; "Orchid","PapayaWhip"/)
>
> I would b grateful for any advice on selecting a colormap for extreme
> values.
>
>
> ;==================================================================
> ;Here is a section of my code that draws a color fill plot
> ;===================================================================
>
> wks = gsn_open_wks("pdf","all_Evaporation_diff1")
> gsn_define_colormap(wks,"prcp_1")
>
> res = True
>
> res at cnFillOn = True ; turn on color
> ;res at gsnSpreadColors = True ; use full colormap
>
> res at cnLinesOn = False ; turn off contour lines
> res at cnLevelSelectionMode = "ExplicitLevels" ; set manual contour levels
> res at cnLevels = (/-1.5,-1.,-0.6,-0.4,-0.3,-0.
> 2,-0.1,0,0.1,0.2,0.3,0.4,0.5/) ; set levels
>
> ;res at cnFillPalette =(/"Snow"/)
>
> ;res at cnFillPalette =(/"Snow","Black","Blue",
> "DarkSeaGreen","PaleTurquoise","PaleGreen","SeaGreen3"
> ,"OliveDrab","Snow","Snow","BurlyWood","Pink","Salmon","Orange","Red"/)
>
> ;res at cnLevels = (/ -3,-1.,-0.5,-0.4,-0.3,-0.2,-0.
> 1,0.1,0.2,0.3,0.4,0.5,1.,3./) ; set levels
> ;res at cnLevels = (/ -4,-1.5,-1.,-0.5,-0.4,-0.3,-0.
> 2,-0.1,0.1,0.2,0.3,0.4,0.5,1./) ; set levels
>
> res at gsnDraw = False ; Do not draw plot
> res at gsnFrame = False ; Do not advance frome
> res at lbLabelBarOn = False ; turn off individual
> label bars
> res at tiMainString = " "
> ;res at tiMainOffsetYF = 0.02 ; Move title up a little
> res at gsnCenterString = " "
> res at gsnLeftString = " "
> res at gsnRightString = " "
> res at cnRasterModeOn = True ; Raster mode shows grid
> cells
> ;gsn_reverse_colormap(wks)
>
> minlat = 30. ; min lat to mask
> maxlat = 80. ; max lat to mask
> minlon = -10. ; min lon to mask
> maxlon = 100. ; max lon to mask
>
> res at mpProjection = "LambertConformal" ; choose projection
>
> ;---masked plot
> res at gsnAddCyclic = True ; regional plot
>
> res at mpMinLatF = minlat ; min lat to mask
> res at mpMaxLatF = maxlat ; max lat to mask
> res at mpMinLonF = minlon ; min lon to mask
> res at mpMaxLonF = maxlon ; max lon to mask
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20180817/3ded6690/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgb.png
Type: image/png
Size: 9275 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180817/3ded6690/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgb.000001.png
Type: image/png
Size: 9275 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180817/3ded6690/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgb.000002.png
Type: image/png
Size: 21820 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180817/3ded6690/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: draw_my_colors.ncl
Type: application/octet-stream
Size: 445 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180817/3ded6690/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: highlight_contours.ncl
Type: application/octet-stream
Size: 1259 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180817/3ded6690/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: highlight_contours.000003.png
Type: image/png
Size: 83373 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180817/3ded6690/attachment-0007.png>
More information about the ncl-talk
mailing list