[ncl-talk] Hown to turn on color fill of map with add labelbar
juki juki
juky_emc2 at yahoo.com
Wed Nov 13 07:42:47 MST 2019
Hi all !
I am using the following add labelbar for my contour plot: http://www.ncl.ucar.edu/Applications/Scripts/polyg_8_lbar.ncl
I am plotting the topography as the background instead of map = gsn_csm_map(wks,mpres)The following is my simple ncl: wks = gsn_open_wks("png","polyg") ; send graphics to PNG file
;---Set up some map resources. mpres = True mpres at gsnMaximize = False ; Maximize plot in frame. mpres at gsnDraw = False ; Will draw later mpres at gsnFrame = False ; Don't advance the frame ; mpres at pmTickMarkDisplayMode = "Always" mpres at gsnAddCyclic = False ; data already has cyclic point mpres at mpGeophysicalLineThicknessF = 1.5 ; thickness of outlines mpres at mpDataBaseVersion = "MediumRes" ; Medium resolution database mpres at cnFillOn = True ; turn on color fill mpres at cnLinesOn = False ; turn of contour lines mpres at cnLineLabelsOn = False ;-- turns off contour line labels mpres at cnInfoLabelOn = False ;-- turns off contour info label mpres at cnLevelSelectionMode = "ManualLevels" ; Set contour levels mpres at cnMinLevelValF = 200 ; the same for each plot. mpres at cnMaxLevelValF = 3000 mpres at cnLevelSpacingF = 200
mpres at mpMinLatF = -7. mpres at mpMaxLatF = 7. mpres at mpMinLonF = 94. mpres at mpMaxLonF = 108. mpres at mpShapeMode = "FreeAspect" mpres at vpWidthF = 0.35 mpres at vpHeightF = 0.25 mpres at tmXBLabelFontHeightF = 0.01 ; resize tick labels mpres at tmYLLabelFontHeightF = 0.01 mpres at gsnMajorLatSpacing = 2 mpres at gsnMajorLonSpacing = 2 mpres at gsnStringFontHeightF = 0.01
map = gsn_csm_contour_map(wks,data1T,mpres)
;data1T is topography data
;--Create logical variables to hold the marker resources. gsres = True gsres at gsMarkerIndex = 16 ; Use filled dots for markers.;; Loop through each grouping of markers, and draw them one set at; a time, assigning the proper color and size with gsn_marker.; base_size = 0.005 pmid = new(num_distinct_markers,graphic) do i = 0, num_distinct_markers-1 if (.not.ismissing(lat_new(i,0))) gsres at gsMarkerColor = colors(i,:) ;gsres at gsMarkerSizeF = base_size * (i+1)/3. gsres at gsMarkerSizeF = base_size gsres at gsMarkerThicknessF = 0.7*(i+1) pmid(i) = gsn_add_polymarker(wks,map,lon_new(i,:),lat_new(i,:),gsres) end if end do
;---Draw labelbar and advance frame. add_labelbar(wks,map,levels,colors) draw(map) frame(wks)
Question: How to turn on the color fill? When I set mpres at cnFillOn = True ; turn on color fill, I got the following error:
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 7901 in file /usr/local/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 11301 in file /usr/local/lib/ncarg/nclscripts/csm/gsn_csm.ncl
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 216 in file rata.ncl
Thank you for help
Juky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191113/e9db1cd4/attachment.html>
More information about the ncl-talk
mailing list