爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4584|回复: 4

[作图] 画图图例设置求助

[复制链接]

新浪微博达人勋

发表于 2023-1-19 10:53:08 | 显示全部楼层 |阅读模式

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

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

x
求助群里的大神!
如图:
捕获.JPG
图例显示两个实线、两个虚线,想要把图例中的两个虚线去掉,只剩下有标注的两个实线要怎么搞?????

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

新浪微博达人勋

发表于 2023-1-21 08:03:26 | 显示全部楼层
Please show the program.


密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2023-1-22 20:54:42 | 显示全部楼层
houtian 发表于 2023-1-21 08:03
Please show the program.

res是常规的设置,画的是组图,这张是其中一个图
res4=res
res4@trYMinF   = 0 ;Y轴上的最小数值
res4@trYMaxF   = 65
res4@tiXAxisString   = "Year"
res4@xyLineColors   =(/"purple","black","purple","black"/) ;
res4@xyDashPatterns = (/0,0,1,1/);
res4@xyLineThicknessF    = (/6.0,6.0/);6.0    ;折线宽度

res4@tmYROn = False
res4@tmXTOn = False

res4@gsnYRefLine = 0
res4@gsnYRefLineDashPattern = 1
res4@gsnYRefLineThicknessF = 6

;图例整体
res4@pmLegendDisplayMode    = "Always"    ;显示方式          ; turn on legend
res4@lgOrientation = "Vertical"
res4@pmLegendSide            = "Top"     ;放置位置,靠哪条坐标轴;IP
res4@pmLegendParallelPosF   = 0.13     ;水平移动,正值向右移
res4@pmLegendOrthogonalPosF = -0.25       ;垂直移动,正值向上移;IP
res4@xyExplicitLegendLabels = (/"Q_I","Q_F","",""/);

res4@pmLegendWidthF         = 0.25                  ; 宽度Change width and
res4@pmLegendHeightF        = 0.15                  ;高度 height of legend.
res4@lgLabelFontHeightF     = .02                 ;图例数据项标注字号 change font height
res4@lgPerimOn              = False                 ;图例边框显隐开关 no box around  
res4@lgBoxMinorExtentF    =0.3   ;缩短图例中每根折线的长度

res4@lgTitleString=""

plot(3) = gsn_csm_xy(wks,x1,pltarry4,res4)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2023-1-25 08:22:13 | 显示全部楼层

    lgres                    = True
    lgres@lgLineColors       = (/"red","green","blue"/)
    lgres@lgItemType         = "Lines"        ; show lines only (default)
    lgres@lgLabelFontHeightF = .08            ; legend label font thickness
    lgres@vpWidthF           = 0.13           ; width of legend (NDC)
    lgres@vpHeightF          = 0.10           ; height of legend (NDC)
    lgres@lgPerimThicknessF  = 2.0            ; thicken the box perimeter
    lgres@lgMonoDashIndex    = True
    lgres@lgDashIndex        = 0
    lgres@lgItemOrder   = ispan(2, 0, 1)
    lgres@lgLineThicknessF = 2

    labels = (/"EL NINO","LA NINA","NEUTRAL"/)
    legend = gsn_create_legend (wks, 3, labels,lgres)

    amres                  = True
    amres@amJust           = "TopRight"    ; Use bottom right corner of box
                                              ; for determining its location.
    amres@amParallelPosF   = 0.5              ; Move legend to right
    amres@amOrthogonalPosF = -0.5              ; Move legend down.

    annoid = gsn_add_annotation(plot1,legend,amres)  ; add legend to plot
    draw(plot1)
    frame(wks)


可以考虑用这种方式添加legend
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2023-1-29 11:53:57 | 显示全部楼层
houtian 发表于 2023-1-25 08:22
lgres                    = True
    lgres@lgLineColors       = (/"red","green","blue"/)
     ...

非常感谢,成功了!
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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