- 积分
- 2589
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-11-20
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我在画组图时循环出图,发现最后一组图比前面都短(因为有了下刻度线,注释掉之后图是一样长的),但以前同样的程序另一个区域为什么没问题?另外我加 res1@vpHeightF = 0.34*ratio
res1@vpWidthF = 0.8*ratio
给所有图,和加vp给最后两张(kl)的效果都是一样的:最后一个色标轴跑到上面去了,但长宽仍然不变
请问这是为什么?
不加vp
加vp
别的区域的图(加vp))
画图设置:
res1 = True
res1@gsnDraw = False ; don't draw yet
res1@gsnFrame = False ; don't advance frame yet
res3 = res1
res1@gsnAddCyclic = False
; res1@vpHeightF = 0.34*ratio ; change aspect ratio of plot
; res1@vpWidthF = 0.8*ratio
res1@mpOutlineOn = True;False
res1@mpFillOn = False
; res1@mpCenterLonF = 180
res1@mpMinLatF = latS
res1@mpMaxLatF = latN
res1@mpMinLonF = lonW
res1@mpMaxLonF = lonE
res1@mpDataSetName = "Earth..4" ;画国界
res1@mpDataBaseVersion = "MediumRes" ; Medium resolution database
res1@mpOutlineOn = True ; Turn on map outlines
res1@mpOutlineSpecifiers = "China:states" ;China:states
res1@mpGeophysicalLineThicknessF = 0.1
res1@mpFillOn = True
res1@cnFillOn = True ; turn on color fill
res1@cnLinesOn = False ; True is default
res1@cnLineLabelsOn = False ; True is default
; panel plot only resources
res1@tmBorderThicknessF = .4 ;坐标轴粗细
res1@tmXBMajorThicknessF = 0.4
res1@tmYLMajorThicknessF = 0.4
res1@tmYRMajorThicknessF = 0.4
res1@tmYLLabelFontHeightF = 0.017*ratio ; Y轴刻度字体大小
res1@tmXBLabelFontHeightF = res1@tmYLLabelFontHeightF ; X轴刻度字体大小
res1@tmYROn = False ;不要右刻度线
res1@tmXTOn = False ;不要上刻度线
res1@tmYLMinorOn = False;不要次刻度线
res1@tmXBMinorOn = False
res1@tmYRMinorOn = False
res1@tmXTMinorOn = False
res1@lbLabelBarOn = False
res1@tmXBOn = False ;不要下刻度线!!!!
res1@tiMainOn = True
res1@tiMainFontHeightF = 0.018*ratio;
res1@tiMainOffsetYF = -0.005;调整主标题垂直位置(上正下负)
;res1单独设置
res1@cnLevelSelectionMode ="ManualLevels" ;"AutomaticLevels" ; "ManualLevels"
res4 = res1;!!!!!!!!!!!!!!res4
res1@cnMinLevelValF = -bmax(0) ;i = 1(0.22)2(0.14)3(0.11)4(0.06)5(0.26)6(0.5)7()
res1@cnMaxLevelValF = bmax(0)
res1@cnLevelSpacingF = LSpac(0)
res1@cnFillPalette = "MPL_RdBu";cmap(::-1,:)
res2 = res1;!!!!!!!!!!!!!!!!res2
res1@tiMainString = mains(0);12
;res2单独设置
res2@tmYLOn = False ;不要左刻度线!!!!
res2@tiYAxisOn = True
res2@tiYAxisFontHeightF = res1@tmYLLabelFontHeightF
res2@tiYAxisSide = "right"
res2@tiYAxisAngleF = -90
res2@tiYAxisOffsetXF = -0.001;调整Y轴水平位置(正右负左)
res5 = res2;!!!!!!!!!!!!!!!!res5
res2@tiYAxisString = rtitile(0)
res2@tiMainString = mains(1);12
cmap = read_colormap_file("MPL_RdYlGn");将色标倒过来
res4@cnFillPalette := cmap;(::-1,:)
res10 = res4;!!!!!!!!!!!!!!!!!res10
res13 = res4;!!!!!!!!!!!!!!!!!res13
res16 = res4;!!!!!!!!!!!!!!!!!res16
res4@cnFillPalette := cmap(::-1,:)
res7 = res4;!!!!!!!!!!!!!!!!!res7
;res4单独设置
res4@cnMinLevelValF = -bmax(1)
res4@cnMaxLevelValF = bmax(1)
res4@cnLevelSpacingF = LSpac(1)
res4@tiMainString = mains(2);12/3
res5@cnFillPalette := cmap
res11 = res5;!!!!!!!!!!!!!!!!!res11
res14 = res5;!!!!!!!!!!!!!!!!!res14
res17 = res5;!!!!!!!!!!!!!!!!!res17
res5@cnFillPalette := cmap(::-1,:)
res8 = res5;!!!!!!!!!!!!!!!!!res8
;res5单独设置
res5@cnMinLevelValF = -bmax(1)
res5@cnMaxLevelValF = bmax(1)
res5@cnLevelSpacingF = LSpac(1)
res5@tiMainString = mains(3);12/4
res5@tiYAxisString = rtitile(1)
;res7单独设置
res7@cnMinLevelValF = -bmax(2)
res7@cnMaxLevelValF = bmax(2)
res7@cnLevelSpacingF = LSpac(2)
res7@tiMainString = mains(4);12/5
; ;res8单独设置
res8@cnMinLevelValF = -bmax(2);6/3
res8@cnMaxLevelValF = bmax(2)
res8@cnLevelSpacingF = LSpac(2)
res8@tiMainString = mains(5);12/6
res8@tiYAxisString = rtitile(2);6/3
; ;res10单独设置
res10@cnMinLevelValF = -bmax(3);6/4
res10@cnMaxLevelValF = bmax(3)
res10@cnLevelSpacingF = LSpac(3)
res10@tiMainString = mains(6);12/7
; ;res11单独设置
res11@cnMinLevelValF = -bmax(3);6/4
res11@cnMaxLevelValF = bmax(3)
res11@cnLevelSpacingF = LSpac(3)
res11@tiMainString = mains(7);12/8
res11@tiYAxisString = rtitile(3);6/4
; ;res13单独设置
res13@cnMinLevelValF = -bmax(4);6/5
res13@cnMaxLevelValF = bmax(4)
res13@cnLevelSpacingF = LSpac(4)
res13@tiMainString = mains(8);12/9
; ;res14单独设置
res14@cnMinLevelValF = -bmax(4);6/5
res14@cnMaxLevelValF = bmax(4)
res14@cnLevelSpacingF = LSpac(4)
res14@tiMainString = mains(9);12/10
res14@tiYAxisString = rtitile(4);6/5
; ;res16单独设置
res16@tmXBOn = True ;不要下刻度线!!!!
res16@cnMinLevelValF = -bmax(5) ;6/6
res16@cnMaxLevelValF = bmax(5)
res16@cnLevelSpacingF = LSpac(5)
res16@tiMainString = mains(10);12/11
; res16@vpHeightF = 0.34*ratio ; change aspect ratio of plot
; res16@vpWidthF = 1.0*ratio
; ;res17单独设置
res17@cnMinLevelValF = -bmax(5);6/6
res17@cnMaxLevelValF = bmax(5)
res17@cnLevelSpacingF = LSpac(5)
res17@tiMainString = mains(11);12/12
res17@tiYAxisString = rtitile(5);6/6
res17@tmXBOn = True ;不要下刻度线!!!!
; res17@vpHeightF = 0.34*ratio ; change aspect ratio of plot
; res17@vpWidthF = 1.0*ratio
;;;;;;;
res3@tiYAxisFontHeightF = 0.017 ;Y轴标题字体大小
res3@tiXAxisFontHeightF = 0.016;res3@tiYAxisFontHeightF ;X轴标题字体大小
res3@tiYAxisOffsetXF = 0.002;0.01 ;Y轴标题水平位置(右加左减)
res3@tiXAxisOffsetYF = 0.002;0.01 ;X轴标题垂直位置(上加下减)
; panel plot only resources
res3@tmBorderThicknessF = .4 ;坐标轴粗细
res3@tmXBMajorThicknessF = 0.4
res3@tmYLMajorThicknessF = 0.4
res3@tmYRMajorThicknessF = 0.4
res3@tmYLLabelFontHeightF = res3@tiYAxisFontHeightF ; Y轴刻度字体大小
res3@tmXBLabelFontHeightF = res3@tiYAxisFontHeightF ; X轴刻度字体大小
; res3@tmXBMajorLengthF = 0.01;Y轴刻度线长度
; res3@tmYLMajorLengthF = res3@tmXBMajorLengthF;X轴刻度线长度
res3@tmYROn = False ;不要右刻度线
res3@tmXTOn = False ;不要上刻度线
res3@tmYLMinorOn = False;不要次刻度线
res3@tmXBMinorOn = False
res3@tmYRMinorOn = False
res3@tmXTMinorOn = False
res3@xyLineThicknesses = (/1.0,1.0/)
res3@xyLineColors = (/"blue","red"/)
res3@xyMonoDashPattern = True ; all solid
res3@tiYAxisString = "PDF(%)";"density"
; res3@gsnXYBarChart = True ; Create bar plot
; res3@gsnXYBarChartOutlineOnly = True
res3@pmLegendDisplayMode = "Always" ; turn on legend
res3@pmLegendSide = "Top" ; Change location of
res3@pmLegendParallelPosF = .2 ; 图例水平方向移动(右加左减)
res3@pmLegendOrthogonalPosF = -0.215 ; 图例垂直方向移动(上加下减)
res3@pmLegendWidthF = 0.08 ; Change width and
res3@pmLegendHeightF = 0.06 ; height of legend.
res3@lgPerimOn = False ; turn off/on box around
res3@lgLabelFontHeightF = .013 ; 标签字体大小
res3@gsnXRefLine = 0.0
res3@gsnXRefLineDashPattern = 5
res3@gsnXRefLineColor = "gray"
res3@gsnXRefLineThickness = 0.6
res3@vpHeightF = 0.30*ratio ; change aspect ratio of plot
res3@vpWidthF = 0.4*ratio
res6 = res3
res9 = res3
res12 = res3
res15 = res3
res18 = res3
;res3单独设置
res3@tiXAxisString = rtitile(0);1/6
res3@xyExplicitLegendLabels = " "+mains(0:1) ; 2/12
;res6单独设置
res6@tiXAxisString = rtitile(1)+" (days)";2/6
res6@xyExplicitLegendLabels = " "+mains(2:3) ; 4/12
;res9单独设置
res9@tiXAxisString = rtitile(2)+" (days)";3/6
res9@xyExplicitLegendLabels = " "+mains(4:5) ; 6/12
;res12单独设置
res12@tiXAxisString = rtitile(3)+" (days)";4/6
res12@xyExplicitLegendLabels = " "+mains(6:7) ; 8/12
;res15单独设置
res15@tiXAxisString = rtitile(4)+" (days)";5/6
res15@xyExplicitLegendLabels = " "+mains(8:9) ; 10/12
;res18单独设置
res18@tiXAxisString = rtitile(5);6/6
res18@xyExplicitLegendLabels = " "+mains(10:11) ; 12/12
;************************************************
; create panel
;************************************************
PStrings = (/"a","b","c","d","e","f","g","h","i","j","k","l"/)
; TitleString = (/"SPEI~B~annual~N~","LGS(days)","iEVI~B~SD~N~"/)
YF = (/0.96,0.96,0.96/)
barloc = -0.006;(/0.95,0.169,-0.02/) ;色标垂直移动(上正下负)6
LabelStride = (/40,40,50,40,40,16/) ;色标间隔数6
tb = (/0.95,0.80/)
resP = True
resP@gsnFrame = False
resP@gsnPanelLabelBar = True ; add common colorbar
resP@lbBoxLinesOn = False ;色标不描线
resP@lbLabelFontHeightF = 0.005 ;色标刻度字体大小
resP@amJust = "TopLeft"
resP@gsnPanelFigureStringsPerimOn = False
resP@gsnPanelFigureStringsFontHeightF = 0.01*ratio;0.009 ;标签字体大小
resP@lbOrientation = "Vertical" ;色标方向
resP@lbBoxLinesOn = False ;绘制色标边框
resP@lbTitleOn = True
resP@lbTitleDirection = "Across"
resP@lbTitleOffsetF = -0.088 ;色标和标题之间的距离,越大离得越远
resP@lbTitleJust = "TopLeft" ;标题的位置(Top, Center, Bottom)和对齐方式(Left, Center, Right)
resP@lbTitleFontHeightF = resP@lbLabelFontHeightF;标题字大小
resP@pmLabelBarOrthogonalPosF = -0.22 ;调整色标垂直方向(如果是Vertical则是调整水平方向,总之与色标垂直方向,正右负左,下正上负)
resP@pmLabelBarWidthF = 0.04 ;宽度
resP@pmLabelBarHeightF = 0.12 ;高度
;调图间距
; resP@gsnMaximize = True
resP@gsnPanelDebug = True ;这个会在出图的时候输出位置信息
resP@gsnPanelCenter = False ;是否中心对齐,比如每行有两幅图最后一行却是一幅图
; setvalues NhlGetWorkspaceObjectId()
; "wsMaximumSize" : 600000000
; end setvalues
plot(0)=gsn_csm_contour_map(wks,data(0,:,:),res1)
plot(1)=gsn_csm_contour_map(wks,data(1,:,:),res2)
plot(2)=gsn_csm_xy(wks, xx(0:1,:), PDF(0:1,:), res3)
plot(3)=gsn_csm_contour_map(wks,data(2,:,:),res4)
plot(4)=gsn_csm_contour_map(wks,data(3,:,:),res5)
plot(5)=gsn_csm_xy(wks, xx(2:3,:), PDF(2:3,:), res6)
plot(6)=gsn_csm_contour_map(wks,data(4,:,:),res7)
plot(7)=gsn_csm_contour_map(wks,data(5,:,:),res8)
plot(8)=gsn_csm_xy(wks, xx(4:5,:), PDF(4:5,:), res9)
plot(9)=gsn_csm_contour_map(wks,data(6,:,:),res10)
plot(10)=gsn_csm_contour_map(wks,data(7,:,:),res11)
plot(11)=gsn_csm_xy(wks, xx(6:7,:), PDF(6:7,:), res12)
plot(12)=gsn_csm_contour_map(wks,data(8,:,:),res13)
plot(13)=gsn_csm_contour_map(wks,data(9,:,:),res14)
plot(14)=gsn_csm_xy(wks, xx(8:9,:), PDF(8:9,:), res15)
plot(15)=gsn_csm_contour_map(wks,data(10,:,:),res16)
plot(16)=gsn_csm_contour_map(wks,data(11,:,:),res17)
plot(17)=gsn_csm_xy(wks, xx(10:11,:), PDF(10:11,:), res18)
;下面两行调整间距,-1代表默认自动值,我这里是三行两列
do i = 0,nvar-1
resP@gsnPanelFigureStrings = PStrings(i*2:i*2+1) ;abcd....
resP@lbTitleString = " "+rtitile(i) ;SPEI,SGS....;加空格使左对齐更准
resP@pmLabelBarParallelPosF = barloc ;调整色标水平方向(增大上移);6
resP@lbLabelStride = LabelStride(i) ;色标间隔数;6
resP@gsnPanelTop = tb(0)
resP@gsnPanelBottom = tb(1)
tb = tb-0.001
resP@gsnPanelXF = (/0.049393,.348,0.71/);(/-1,.499,-1,.499,-1,.499/)
resP@gsnPanelYF = YF;2
YF = YF-0.138;0.19
barloc = barloc-0.000;
gsn_panel(wks,plot(i*3:i*3+2),(/1,3/),resP)
end do
frame(wks)
|
|