;************************************************* ; colormap_2.ncl ; ; Concepts illustrated: ; - Drawing the current color map ; - Selecting a different color map ; - Creating a color map using named colors ; - Creating a color map using RGB triplets ; ;************************************************ ; Note: in NCL V6.3.0 you can use the new ; draw_color_palette procedure to draw any ; set of colors without having to call ; gsn_define_colormap first. ; ; See colormap_2a.ncl ;************************************************ ; ; This file is loaded by default in NCL V6.2.0 and newer ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" ;************************************************ begin wks = gsn_open_wks("png","colormap") ; send graphics to PNG file ; Change color map using built-in color table. gsn_define_colormap(wks,"WhViBlGrYeOrReWh") ; change colormap gsn_draw_colormap(wks) ; draw new colormap ; Change color map using named colors colors = (/"firebrick","peachpuff","orangered","navyblue","peru",\ "yellow","wheat1","gray55","thistle","coral","dodgerblue", \ "seagreen","maroon","gold","turquoise","mediumorchid"/) gsn_define_colormap(wks,colors) ; change colormap gsn_draw_colormap(wks) ; draw new colormap ; Change color map using RGB values. cmap = (/(/0.00,0.00,0.00/), (/0.20,0.00,0.00/), (/0.40,0.00,0.00/), \ (/0.60,0.00,0.00/), (/0.80,0.00,0.00/), (/1.00,0.00,0.00/), \ (/0.00,0.00,0.20/), (/0.20,0.00,0.20/), (/0.40,0.00,0.20/), \ (/0.60,0.00,0.20/), (/0.80,0.00,0.20/), (/1.00,0.00,0.20/), \ (/0.00,0.00,0.40/), (/0.20,0.00,0.40/), (/0.40,0.00,0.40/), \ (/0.60,0.00,0.40/), (/0.80,0.00,0.40/), (/1.00,0.00,0.40/), \ (/0.00,0.00,0.60/), (/0.20,0.00,0.60/), (/0.40,0.00,0.60/), \ (/0.60,0.00,0.60/), (/0.80,0.00,0.60/), (/1.00,0.00,0.60/), \ (/0.00,0.00,0.80/), (/0.20,0.00,0.80/), (/0.40,0.00,0.80/), \ (/0.60,0.00,0.80/), (/0.80,0.00,0.80/), (/1.00,0.00,0.80/), \ (/0.00,0.00,1.00/), (/0.20,0.00,1.00/), (/0.40,0.00,1.00/), \ (/0.60,0.00,1.00/), (/0.80,0.00,1.00/), (/1.00,0.00,1.00/), \ (/0.00,0.20,0.00/), (/0.20,0.20,0.00/), (/0.40,0.20,0.00/), \ (/0.60,0.20,0.00/), (/0.80,0.20,0.00/), (/1.00,0.20,0.00/), \ (/0.00,0.20,0.20/), (/0.20,0.20,0.20/), (/0.40,0.20,0.20/), \ (/0.60,0.20,0.20/), (/0.80,0.20,0.20/), (/1.00,0.20,0.20/), \ (/0.00,0.20,0.40/), (/0.20,0.20,0.40/), (/0.40,0.20,0.40/), \ (/0.60,0.20,0.40/), (/0.80,0.20,0.40/), (/1.00,0.20,0.40/), \ (/0.00,0.20,0.60/), (/0.20,0.20,0.60/), (/0.40,0.20,0.60/), \ (/0.60,0.20,0.60/), (/0.80,0.20,0.60/), (/1.00,0.20,0.60/), \ (/0.00,0.20,0.80/), (/0.20,0.20,0.80/), (/0.40,0.20,0.80/), \ (/0.60,0.20,0.80/), (/0.80,0.20,0.80/), (/1.00,0.20,0.80/), \ (/0.00,0.20,1.00/), (/0.20,0.20,1.00/), (/0.40,0.20,1.00/), \ (/0.60,0.20,1.00/), (/0.80,0.20,1.00/), (/1.00,0.20,1.00/), \ (/0.00,0.40,0.00/), (/0.20,0.40,0.00/), (/0.40,0.40,0.00/), \ (/0.60,0.40,0.00/), (/0.80,0.40,0.00/), (/1.00,0.40,0.00/), \ (/0.00,0.40,0.20/), (/0.20,0.40,0.20/), (/0.40,0.40,0.20/), \ (/0.60,0.40,0.20/), (/0.80,0.40,0.20/), (/1.00,0.40,0.20/), \ (/0.00,0.40,0.40/), (/0.20,0.40,0.40/), (/0.40,0.40,0.40/), \ (/0.60,0.40,0.40/), (/0.80,0.40,0.40/), (/1.00,0.40,0.40/), \ (/0.00,0.40,0.60/), (/0.20,0.40,0.60/), (/0.40,0.40,0.60/), \ (/0.60,0.40,0.60/), (/0.80,0.40,0.60/), (/1.00,0.40,0.60/), \ (/0.00,0.40,0.80/), (/0.20,0.40,0.80/), (/0.40,0.40,0.80/), \ (/0.60,0.40,0.80/), (/0.80,0.40,0.80/), (/1.00,0.40,0.80/), \ (/0.00,0.40,1.00/), (/0.20,0.40,1.00/), (/0.40,0.40,1.00/), \ (/0.60,0.40,1.00/), (/0.80,0.40,1.00/), (/1.00,0.40,1.00/), \ (/0.00,0.60,0.00/), (/0.20,0.60,0.00/), (/0.40,0.60,0.00/), \ (/0.60,0.60,0.00/), (/0.80,0.60,0.00/), (/1.00,0.60,0.00/), \ (/0.00,0.60,0.20/), (/0.20,0.60,0.20/), (/0.40,0.60,0.20/), \ (/0.60,0.60,0.20/), (/0.80,0.60,0.20/), (/1.00,0.60,0.20/), \ (/0.00,0.60,0.40/), (/0.20,0.60,0.40/), (/0.40,0.60,0.40/), \ (/0.60,0.60,0.40/), (/0.80,0.60,0.40/), (/1.00,0.60,0.40/), \ (/0.00,0.60,0.60/), (/0.20,0.60,0.60/), (/0.40,0.60,0.60/), \ (/0.60,0.60,0.60/), (/0.80,0.60,0.60/), (/1.00,0.60,0.60/), \ (/0.00,0.60,0.80/), (/0.20,0.60,0.80/), (/0.40,0.60,0.80/), \ (/0.60,0.60,0.80/), (/0.80,0.60,0.80/), (/1.00,0.60,0.80/), \ (/0.00,0.60,1.00/), (/0.20,0.60,1.00/), (/0.40,0.60,1.00/), \ (/0.60,0.60,1.00/), (/0.80,0.60,1.00/), (/1.00,0.60,1.00/), \ (/0.00,0.80,0.00/), (/0.20,0.80,0.00/), (/0.40,0.80,0.00/), \ (/0.60,0.80,0.00/), (/0.80,0.80,0.00/), (/1.00,0.80,0.00/), \ (/0.00,0.80,0.20/), (/0.20,0.80,0.20/), (/0.40,0.80,0.20/), \ (/0.60,0.80,0.20/), (/0.80,0.80,0.20/), (/1.00,0.80,0.20/), \ (/0.00,0.80,0.40/), (/0.20,0.80,0.40/), (/0.40,0.80,0.40/), \ (/0.60,0.80,0.40/), (/0.80,0.80,0.40/), (/1.00,0.80,0.40/), \ (/0.00,0.80,0.60/), (/0.20,0.80,0.60/), (/0.40,0.80,0.60/), \ (/0.60,0.80,0.60/), (/0.80,0.80,0.60/), (/1.00,0.80,0.60/), \ (/0.00,0.80,0.80/), (/0.20,0.80,0.80/), (/0.40,0.80,0.80/), \ (/0.60,0.80,0.80/), (/0.80,0.80,0.80/), (/1.00,0.80,0.80/), \ (/0.00,0.80,1.00/), (/0.20,0.80,1.00/), (/0.40,0.80,1.00/), \ (/0.60,0.80,1.00/), (/0.80,0.80,1.00/), (/1.00,0.80,1.00/), \ (/0.00,1.00,0.00/), (/0.20,1.00,0.00/), (/0.40,1.00,0.00/), \ (/0.60,1.00,0.00/), (/0.80,1.00,0.00/), (/1.00,1.00,0.00/), \ (/0.00,1.00,0.20/), (/0.20,1.00,0.20/), (/0.40,1.00,0.20/), \ (/0.60,1.00,0.20/), (/0.80,1.00,0.20/), (/1.00,1.00,0.20/), \ (/0.00,1.00,0.40/), (/0.20,1.00,0.40/), (/0.40,1.00,0.40/), \ (/0.60,1.00,0.40/), (/0.80,1.00,0.40/), (/1.00,1.00,0.40/), \ (/0.00,1.00,0.60/), (/0.20,1.00,0.60/), (/0.40,1.00,0.60/), \ (/0.60,1.00,0.60/), (/0.80,1.00,0.60/), (/1.00,1.00,0.60/), \ (/0.00,1.00,0.80/), (/0.20,1.00,0.80/), (/0.40,1.00,0.80/), \ (/0.60,1.00,0.80/), (/0.80,1.00,0.80/), (/1.00,1.00,0.80/), \ (/0.00,1.00,1.00/), (/0.20,1.00,1.00/), (/0.40,1.00,1.00/), \ (/0.60,1.00,1.00/), (/0.80,1.00,1.00/), (/1.00,1.00,1.00/)/) gsn_define_colormap(wks,cmap) ; change colormap gsn_draw_colormap(wks) ; draw new colormap end