load "gsn_code.ncl" load "hsv2rgb.ncl" begin ncolors = 16 ; Plus two colors for background and foreground. hmin = 225. ; hue min hmax = 360. ; hue max smin = 0.67 ; saturation min smax = 0.67 ; saturation max vmin = 1.0 ; value (intensity) min vmax = 1.0 ; value max hue = fspan(hmin,hmax,ncolors) sat = fspan(smin,smax,ncolors) val = fspan(vmin,vmax,ncolors) cmap = new((/ncolors+2,3/),float) cmap(0,:) = (/1.,1.,1./) ; white cmap(1,:) = (/0.,0.,0./) ; black cmap(2:ncolors+1,:) = hsv2rgb(hue,sat,val) wks = gsn_open_wks("x11","example") ; Open an X11 window. gsn_define_colormap(wks,cmap) ; Set the new colormap. lbres = True lbres@lbAutoManage = False lbres@lbFillColors = ispan(0,ncolors+1,1) lbres@lbLabelFontHeightF = 0.02 lbres@lbMonoFillPattern = True lbres@lbOrientation = "Horizontal" lbres@lbPerimOn = False lbres@vpHeightF = 0.40 lbres@vpWidthF = 0.98 lbstrings = ":F26:" + ispan(0,ncolors+1,1) ; Labels for labelbar. gsn_labelbar_ndc(wks,ncolors+2,lbstrings,0.01,0.98,lbres) ; Draw a ; labelbar. ; ; Title at the bottom. ; textres = True textres@txFontHeightF = 0.03 gsn_text_ndc(wks,":F26:color indices",.5,.64,textres) frame(wks) ; Advance frame. end