- 积分
- 4155
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-4-26
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
四个不同的站点分类,加有中国省会的底图。代码和图形效果如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
;************************************************
begin
;************************************************
; Generate some random data
;************************************************
h = asciiread("/home/scatter/haidao.txt", (/361,2/), "float")
f = asciiread("/home/scatter/fubiao.txt", (/41,2/), "float")
p = asciiread("/home/scatter/pingtai.txt", (/35,2/), "float")
y = asciiread("/home/scatter/yanhai.txt", (/536,2/), "float")
lonh = h(:,0)
lath = h(:,1)
lonf = f(:,0)
latf = f(:,1)
lonp = p(:,0)
latp = p(:,1)
lony = y(:,0)
laty = y(:,1)
;
; There are some stations with lat/lon values outside range, so
; set these to missing.
;
wks = gsn_open_wks ("pdf","/home/scatter/plot/scatter") ; send graphics to PNG file
res = True ; plot mods desired
res@gsnFrame = False ; don't advance yet
res@gsnDraw = False
res@gsnMaximize = True
res@mpMinLatF = 0
res@mpMaxLatF = 55
res@mpMinLonF = 70
res@mpMaxLonF = 140
res@mpOutlineOn = True
res@mpFillOn = False
res@mpOutlineBoundarySets = "National" ; 边界线设置
res@mpDataBaseVersion = "MediumRes"
res@mpDataSetName = "Earth..4"
res@mpOutlineSpecifiers = "China:states"
res@pmTickMarkDisplayMode = "Always"
res@tmXBLabelFontHeightF = 0.017
res@tiMainString = "Locations of stations"
map = gsn_csm_map(wks,res) ; Create the map plot, don't draw
hkres = True
hkres@gsMarkerIndex = 1
hkres@gsMarkerColor = "Blue"
gsn_polymarker(wks,map,lonh,lath,hkres)
fkres = True
fkres@gsMarkerIndex = 2
fkres@gsMarkerColor = "Black"
gsn_polymarker(wks,map,lonf,latf,fkres)
pkres = True
pkres@gsMarkerIndex = 3
pkres@gsMarkerColor = "red"
gsn_polymarker(wks,map,lonp,latp,pkres)
ykres = True
ykres@gsMarkerIndex = 12
ykres@gsMarkerColor = "orange"
gsn_polymarker(wks,map,lony,laty,ykres)
frame(wks)
; If you resize the plot, the markers will be resized accordingly.
;
hkres@gsMarkerColor = "Blue"
hkres@gsMarkerSizeF = 15. ; Increase marker sizes.
dum1 = gsn_add_polymarker(wks,map,lonh,lath,hkres)
fkres@gsMarkerColor = "Black"
fkres@gsMarkerSizeF = 15.
dum2 = gsn_add_polymarker(wks,map,lonf,latf,fkres)
pkres@gsMarkerColor = "red"
pkres@gsMarkerSizeF = 15.
dum3 = gsn_add_polymarker(wks,map,lonp,latp,pkres)
ykres@gsMarkerColor = "orange"
ykres@gsMarkerSizeF = 15.
dum4 = gsn_add_polymarker(wks,map,lony,laty,ykres)
; Draw some individual labelbars.
;----------------------------------------------------------------------
lbres = True ; labelbar only resources
lbres@vpWidthF = 0.1 ; labelbar width
lbres@vpHeightF = 0.1 ; labelbar height
lbres@lbBoxMajorExtentF = 0.15 ; puts space between color boxes
lbres@lbMonoFillPattern = True ; Solid fill pattern
lbres@lbLabelFontHeightF = 0.015 ; font height. default is small
lbres@lbLabelJust = "CenterLeft" ; left justify labels
lbres@lbPerimOn = False
;----------------------------------------------------------------------
; Draw some markers and text.
;----------------------------------------------------------------------
labels2 = (/"haidao","fubiao","pingtai","yanhai"/)
colors1 = (/"Blue","Black","red","orange"/)
markers1 = (/ 1, 2, 3, 12/)
xpos1 = (/ 0.15, 0.30, 0.45, 0.60/)
xpos2 = (/ 0.18, 0.33, 0.48, 0.63/)
;xpos1 = (/0.05, 0.20, 0.35, 0.50/)
mkres = lbres ; Marker resources
txres = True ; Text resources
txres@txFontHeightF = 0.015
txres@txJust = "CenterLeft"
do i = 0,3
mkres@gsMarkerThicknessF = 3.5
mkres@gsMarkerSizeF = 0.02
mkres@gsMarkerIndex = markers1(i)
mkres@gsMarkerColor = colors1(i)
; gsn_polymarker_ndc(wks, xpos1(i),0.16,mkres)
; gsn_text_ndc (wks,labels2(i),xpos2(i),0.16,txres)
gsn_polymarker_ndc(wks, xpos1(i),0.07,mkres)
gsn_text_ndc (wks,labels2(i),xpos2(i),0.07,txres)
end do
draw(map)
frame(wks)
end
|
|