[ncl-talk] How to change the line thickness of predefined fill patterns

Bian Qingyun bianqy at tea.ac.cn
Mon May 13 14:09:55 MDT 2019




Hi Adam,

Thank you for your suggestion! Attached is the figure. Here is my script.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

load "./shapefile_utils.ncl"
begin

;---read data
dir = "../data/"
fin = addfile(dir+"data_num_2001.nc","r")   ;---edit
lat = fin->lat
lon = fin->lonp = 1 - fin->p(0,:,:)
R =   fin->p(1,:,:)


;---plot
type = "x11"    ;----- edit -----
wks = gsn_open_wks(type,"png_panel_snowh_trend_vsstation_1980-2009_yearly")
gsn_define_colormap(wks,"ncl_default")

;---resources for color-filled plot
res                     = True
res at gsnMaximize       = True          ; maximize size in frame
res at gsnDraw             = False         ; Don't draw plots
res at gsnFrame            = False         ; Don't advance frame
res at mpFillOn = False
res at cnFillOn            = True          ; Turn on contour fill
res at cnLinesOn           = False         ; Turn off contour lines
res at cnLevelSelectionMode = "ExplicitLevels"
res at cnLevels = (/-0.2,-0.1,-0.05,-0.02,0,0.02,0.05,0.1,0.2/)
res at cnFillColors = (/2,18,50,82,114,141,178,194,226,248/)
res at mpMinLonF = 67    ;TP
res at mpMaxLonF = 105
res at mpMinLatF = 25
res at mpMaxLatF = 40
res at gsnAddCyclic = False

;---resources for polyline
shp_filename = "TibetanPlateau.shp"
lnres                  = True
lnres at gsLineColor      = "black"
lnres at gsLineThicknessF = 3.0
;lnres at gsLineDashPattern = 13

;-----Open shapefile and read lat/lon values
data_mask_0 = shapefile_mask_data(R,shp_filename,True)
plot_fill   = gsn_csm_contour_map(wks,data_mask_0,res)  ; Create filled contours
line_mask_0 = gsn_add_shapefile_polylines(wks,plot_fill,shp_filename, lnres)

;---resources for shaded plot
delete(res at cnLevels)
res at cnMonoFillColor   = True
res at cnLevels = (/0.05,0.2/)
res at cnMonoFillPattern = False     ; Use multiple fill patterns
res at cnFillPatterns = (/1,2,3/) ;fill with horizontal line, vertical line and slash

;---change the thickness of the horizontal line, vertical line and slash
res at cnMonoLineThickness = True ;
res at cnLineThicknessF = 4

data_mask_1 = shapefile_mask_data(p,shp_filename,True)
plot_shade = gsn_csm_contour(wks,data_mask_1,res)  ; Create shaded contours
line_mask_1 = gsn_add_shapefile_polylines(wks,plot_shade,shp_filename, lnres)

;---Overlay will transform plot_shade into data space of plot_fill
overlay(plot_fill,plot_shade)

;---This call resizes plot so it fits in frame
pres = True
maximize_output(wks,pres)

end

;;;;;;;;;;;;;;;;;;;;;;;;;

I want to make the line thicker in the shaded plot using the following resources, but they didn't work.

;---change the thickness of the horizontal line, vertical line and slash
res at cnMonoLineThickness = True ;
res at cnLineThicknessF = 4

I have no idea how to change the line thickness. Any suggestions are appreciated!

Best,

Qingyun




-----Original Messages-----
From:"Adam Phillips" <asphilli at ucar.edu>
Sent Time:2019-05-14 03:24:05 (Tuesday)
To: "Bian Qingyun" <bianqy at tea.ac.cn>
Cc: Ncl-talk <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] How to change the line thickness of predefined fill patterns


Hi Qingyun,
Can you send along a simplified script and the resulting image to the ncl-talk list so everyone can see the issue? Doing that would make it easier for folks to assist. 
Adam


On Sun, May 12, 2019 at 8:05 PM Bian Qingyun <bianqy at tea.ac.cn> wrote:



Hello,

I overlay a shaded contour plot on a filled contour plot following overlay_10.ncl from the NCL website.

Here are the resources for the shaded plot.

;---Resources for shaded plot
res at cnLevels = (/0.05,0.2/)
res at cnMonoFillPattern = False        ; Use multiple fill patterns
res at cnFillPatterns = (/1,2,3/)   ;predefined fill pattern 1, 2 and 3
res at cnMonoFillColor   = True         ; Use same color for shading
res at lbLabelBarOn = False

The question is I want change the line thicknesses of the predefined fill pattern 1, 2 and 3. I add the following resources, but they didn't work. 
res at cnMonoLineThickness = True
res at cnLineThicknessF = 6



Any suggestions are appreciated! 

Best,

Qingyun




_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk





--

Adam Phillips

Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR

www.cgd.ucar.edu/staff/asphilli/   303-497-1726



--


-------------------------------------------------------

边晴云 中国科学院大气物理研究所

TEL:18710037107

★☆活着,其实就是活一种精神状态~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190514/2eff02a7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Figure.png
Type: image/png
Size: 122317 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190514/2eff02a7/attachment.png>


More information about the ncl-talk mailing list