爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5462|回复: 3

[作图] 色标问题

[复制链接]

新浪微博达人勋

发表于 2017-7-6 16:18:07 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 ekateril 于 2017-7-6 16:20 编辑

1.为什么设置为cnLevelSelectionMode = "ManualLevels"时,等值线可以显示,但色标会自动添加三个多余的,如左图所示,
2.设置cnLevelSelectionMode = "ExplicitLevels"时色标正常显示,但等值线没出来,不知为何?如右图所示

部分代码如下:

wks = gsn_open_wks("x11","sea-level_Pressure")    ; open wk station
    gsn_define_colormap(wks,"NCV_jaisnd")  ; load color table
;;; Font Style
    res1                 = True                                   ; plots modification on ; plot mods desired
    res1@txFont          = "Helvetica"
    res1@txFontQuality   = "High"
;;; Title 设置图片标题
    ;res1@tiMainFont           = "ManualLevels"
    res1@cnFillDrawOrder       = "PreDraw"
    res1@tiMainOffsetYF       = 0.02                          ;set place for main title alongY,offset
    res1@tiMainFontHeightF    = 0.02                          ;set main title fontsize
    res1@gsnLeftString        = "Sea-level_Pressure"
    res1@gsnRightString       = "2017/06/16/00(UTC)"                       ;~S~o~N~C:表示温度单位℃
    res1@gsnMaximize          = True
    res1@gsnDraw              = False
    res1@gsnFrame             = False
    res1@gsnSpreadColors      = True
    res1@pmTickMarkDisplayMode = "Always"
    res1@mpGridAndLimbOn       = True                    ; open grid
    res1@mpGridLineDashPattern = 10
    res1@mpGridLatSpacingF     = 20
    res1@mpGridLineThicknessF  = 1.0
    res1@mpGridLineColor       = "grey"
    res1@mpGridLatSpacingF     = 20
    res1@mpGridLonSpacingF     = 20
;;; Map   
    res1@mpOutlineOn           = True                     ; draw map outlines
    res1@mpFillOn              = True   
    res1@mpDataSetName         = "Earth..4"               ; high resolution
    res1@mpDataBaseVersion     = "MediumRes"               
    res1@mpProvincialLineColor  = 0
    res1@mpCountyLineColor      = 2
    ;设置经纬度范围,亚洲范围经纬度
    res1@mpLimitMode             = "latlon"
    res1@mpMinLatF               = 7               
    res1@mpMaxLatF               = 50
    res1@mpMinLonF               = 90
    res1@mpMaxLonF               = 135  
    res1@mpOutlineSpecifiers     = (/"China:states"/)
    res1@mpGeophysicalLineColor  = "grey"       ; color of cont. outlines
                                                ; thickness of outlines
    ;加粗边界线。
    res1@mpGeophysicalLineThicknessF  = 1.         ; double the thickness of geophysical boundaries
    ;res1@mpNationalLineThicknessF    = 1.        ; double the thickness of national boundaries
    ;;; Map Projection (min and max Lon and Lat)
    res1@gsnAddCyclic          = False             ; data already has cyclic point;为false表示不循环地球一周                                               ; this must also be set for any zoom
    res1@mpProjection          = "LambertConformal" ;兰伯特投影
    res1@mpLambertMeridianF    = 110
    res1@mpLambertParallel1F   = .001              ;default:.001
    res1@mpLambertParallel2F   = 89.999            ;default:89.999

    ;填充中国行政区域范围
    ;res1@mpAreaMaskingOn        = True                          ;是表示能填充覆盖
    ;res1@mpMaskAreaSpecifiers   = (/"China:states"/)            ;China:states
    res1@mpOceanFillColor       = 0                           ;用变色填充海洋 0是clormap的索引值
    res1@mpLandFillColor        = 0
     
    res1@cnFillOn              = True           ; turn of color fill
    res1@cnLinesOn             = True            ; turn of contour lines 显示等值线
    res1@cnLineLabelsOn        = True
    res1@cnInfoLabelOn         = False  
    res1@cnLevelSelectionMode = "ManualLevels"    ; set explicit contour levels
    ;res1@cnMinLevelValF        = 985             ;set min contour level
    ;res1@cnMaxLevelValF        = 1029             ; set max contour level
    ;res1@cnLevelSpacingF       =  2             ; set contour spacing
    res1@cnMonoLineColor       =  False
    res1@cnLineThicknessF      = 2.5
    ;res1@cnFillPalette        = "gui_default"
    ;res1@cnLineLabelInterval   =  1
  ;;;label
    res1@lbOrientation          = "Vertical"
    res1@tmXTOn                 = False
    res1@tmYROn                 = False
    res1@tmXBLabelFontHeightF   = 0.035
    res1@tmYLLabelFontHeightF   = 0.0

;;; color fill tresholds and colors 设置图例的配色方案
  
    res1@cnLevels               = (/985,987.5,990,992.5,995,997.5,1017.5,\
                                     1020,1022.5,1025,1027.5,1029/)   ; set levels

    res1@cnFillColors           = (/ 225,210,201,190,175,137,0,\     
                                      75,60,50,40,33,26/)    ; set the colors to be used
;;; label bars style
;;; if not set standard values are used.
;;; so you normally can delete these lines without any problems

    ;res1@lbAutoManage          = False              ; control label bar
    res1@pmLabelBarDisplayMode = "Always"            ; turns on label bar
    res1@lbLabelAutoStride     = True
    res1@pmLabelBarWidthF      = 0.08
    res1@pmLabelBarHeightF     = 0.65
    res1@lbLabelFontHeightF    = 0.015
    res1@lbPerimOn             = False
    res1@lbLabelFont           = "Helvetica"         ; label font
    res1@lbLabelStride         = 1
    res1@lbTitleOn             = False                                   ; turn on title
    res1@lbLabelStrings        = (/"985","987.5","990","992.5","995","997.5","1017.5",\
                                  "1020","1022.5","1025","1027.5","1029"/)

20170706162234.png 33.png

密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-6 16:20:32 | 显示全部楼层
{:eb302:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2017-7-6 20:27:06 | 显示全部楼层
    res1@cnLevelSelectionMode = "ManualLevels"    ; set explicit contour levels
    res1@cnMinLevelValF        = 985             ;set min contour level
    res1@cnMaxLevelValF        = 1029             ; set max contour level
    res1@cnLevelSpacingF       =  2             ; set contour spacing
;******************************************************
res1@cnLevelSelectionMode  = "ExplicitLevels"     
res1@cnLevels               = (/985,987.5,990,992.5,995,997.5,1017.5,\
                                     1020,1022.5,1025,1027.5,1029/)   ; set levels
res1@cnFillColors           = (/ 225,210,201,190,175,137,0,\     
                                      75,60,50,40,33,26/)    ; set the colors to be used

你这里这两种是不是混用了?尝试只用一种?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-6 23:06:55 | 显示全部楼层
柚子皮 发表于 2017-7-6 20:27
res1@cnLevelSelectionMode = "ManualLevels"    ; set explicit contour levels
    res1@cnMinLevel ...

如果使用ExplicitLevels的话,等值线不会出来,设置ManualLevels的话等值线能出来,不知为何?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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