爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6320|回复: 5

panel 图只使用了第一个图的色标 为什么

[复制链接]
发表于 2015-12-7 11:23:47 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
将Panel图和panel图中的每个小图比较发现 panel图使用的色标是第一幅图的   根本没有用统一共同的色标啊 有控制使用同一个色标的命令啊
我的程序是
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
cs1 =new((/10,49,80,80/),float)
cs2 =new((/10,49,80,80/),float)
cs3 =new((/10,49,80,80/),float)
cs4 =new((/10,49,80,80/),float)
cs5 =new((/10,49,80,80/),float)
do xuhao = 1,10
a = addfile("/gpfshome/zhanglei2/yuanguanghui/jieguo/meigai/wrfout_d03_"+xuhao+".nc","r")
b = addfile("/gpfshome/zhanglei2/yuanguanghui/jieguo/+25/wrfout_d03_"+xuhao+".nc","r")
c = addfile("/gpfshome/zhanglei2/yuanguanghui/jieguo/+50/wrfout_d03_"+xuhao+".nc","r")
d = addfile("/gpfshome/zhanglei2/yuanguanghui/jieguo/-25/wrfout_d03_"+xuhao+".nc","r")
e = addfile("/gpfshome/zhanglei2/yuanguanghui/jieguo/-50/wrfout_d03_"+xuhao+".nc","r")
sh1 = wrf_user_getvar(a,"LH",-1)
cs1(xuhao-1,:,:,:)=sh1(:,:,:)
sh2 = wrf_user_getvar(b,"LH",-1)
cs2(xuhao-1,:,:,:)=sh2(:,:,:)
sh3 = wrf_user_getvar(c,"LH",-1)
cs3(xuhao-1,:,:,:)=sh3(:,:,:)
sh4 = wrf_user_getvar(d,"LH",-1)
cs4(xuhao-1,:,:,:)=sh4(:,:,:)
sh5 = wrf_user_getvar(e,"LH",-1)
cs5(xuhao-1,:,:,:)=sh5(:,:,:)
end do
x1=dim_avg_n(cs1,0)
x2=dim_avg_n(cs2,0)
x3=dim_avg_n(cs3,0)
x4=dim_avg_n(cs4,0)
x5=dim_avg_n(cs5,0)

;  type = "x11"
  type = "png"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"latent heat flux")
  gsn_define_colormap(wks,"Redblue")  ; overwrite the .hluresfile color map

; Set some basic resources
  res = True
  res@NoHeaderFooter           = True            ; Switch headers and footers off
  res@cnFillOn = True
res@lbLabelBarOn = False
  pltres = True
  pltres@PanelPlot = True      ; Indicate these plots are to be paneled.
  pltres@CommonTitle = True
  mpres = True
  mpres@tmXBLabelFontHeightF = 0.02
  mpres@tmYLLabelFontHeightF = 0.02
  mpres@vpWidthF         = 0.8                      ; set width and height
  mpres@vpHeightF        = 0.3
  mpres@vpXF = 0.1
  mpres@vpYF = 0.9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
times = wrf_user_getvar(a,"times",-1)
  ntimes = dimsizes(times)
do it=17,41,1
print("Working on time: " + times(it))
res@TimeLabel = times(it)
  plots = new ( 5, graphic )
     contour = wrf_contour(a,wks,x1(it,:,:),res)
        pltres@PlotTitle =  "CTL"
        plots(0) = wrf_map_overlays(a,wks,contour,pltres,mpres)
        delete(contour)
        contour = wrf_contour(b,wks,x2(it,:,:),res)
        pltres@PlotTitle =  "Wet25"
        plots(1) = wrf_map_overlays(b,wks,contour,pltres,mpres)
        delete(contour)
;**********************************************************************
        contour = wrf_contour(c,wks,x3(it,:,:),res)
        pltres@PlotTitle =  "Wet50"
        plots(2) = wrf_map_overlays(c,wks,contour,pltres,mpres)
        delete(contour)
;**********************************************************************
       contour = wrf_contour(d,wks,x4(it,:,:),res)
        pltres@PlotTitle =  "Dry25"
        plots(3) = wrf_map_overlays(d,wks,contour,pltres,mpres)
        delete(contour)
;**********************************************************************
        contour = wrf_contour(e,wks,x5(it,:,:),res)
        pltres@PlotTitle = "Dry50"
        pltres@gsnLeftStringFontHeightF = 0.05
        plots(4) = wrf_map_overlays(e,wks,contour,pltres,mpres)
        delete(contour)
;**********************************************************************
  ; Panel the WRF plots.
    pnlres                            = True
    pnlres@txString                   = sh1@description + "  (" + sh1@units + ")"
;    pnlres@gsnPanelYWhiteSpacePercent = 13       ; Add white space b/w plots.
    pnlres@gsnPanelLabelBar           = True    ; Turn on common labelbar
    pnlres@lbLabelAutoStride          = True    ; Spacing of lbar labels.
    pnlres@lbBoxMinorExtentF          = 0.13
    pnlres@gsnMaximize         = True
    pnlres@gsnPanelBottom   = 0.05
    pnlres@gsnPanelFigureStrings= (/"a)","b)","c)","d)","e)"/)
    pnlres@amJust   = "TopLeft"
    pnlres@gsnPanelYWhiteSpacePercent = 5
    pnlres@gsnPanelXWhiteSpacePercent = 5
    gsn_panel(wks,plots,(/2,3/),pnlres)
end do
end

panel图

panel图

panel中的第三幅图

panel中的第三幅图
密码修改失败请联系微信:mofangbao
发表于 2015-12-11 22:08:54 | 显示全部楼层
设置统一的等值线范围和间隔?
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

发表于 2015-12-10 08:30:39 | 显示全部楼层
每次重新画shaded的时候要重新设set color
密码修改失败请联系微信:mofangbao
发表于 2015-12-10 08:36:28 | 显示全部楼层
楼主的这个问题解决了没。。。
密码修改失败请联系微信:mofangbao
发表于 2016-1-19 10:40:40 | 显示全部楼层
同求,怎么设置使得三张图共用一个色标
密码修改失败请联系微信:mofangbao
发表于 2016-11-24 14:41:08 | 显示全部楼层
我也刚发现这个问题,必须要
res@cnLevelSelectionMode        = "ManualLevels"
res@cnMinLevelValF                 = -50.             ; minimum level
res@cnMaxLevelValF                 =  50.             ; maximum level
res@cnLevelSpacingF                =   5.
或者
res@cnLevelSelectionMode           = "ExplicitLevels"
res@cnLevels                       = (/-1.6,-1.3,-1.0,-0.8,-0.6/)               
res@cnFillColors                   = (/14,29,44,59,74,89/)
这样情况下色标才是统一的,其实官网上panel plot的例子中有注释写明过的
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表