[ncl-talk] how to add horizontal constant lines to a plot

Anahita Amiri Farahani aamir003 at ucr.edu
Wed Mar 29 22:17:39 MDT 2017


Hello all,

I want to add three horizontal constant lines (solid and dashed) at
different altitudes (1,2, and 3 km) with different colors to my plot but I
don't know how to do it. I have attached the figure and the code.




 wks = gsn_open_wks("eps","vertical_whole")
; gsn_define_colormap(wks,"gui_default")
 plot = new(4,graphic)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  res                     = True               ; plot mods desired
res at gsnFrame        = False   ; don't draw yet
 res at gsnDraw         = False   ; don't advance frame yet

res at tiXAxisString = "Dust extinction coefficient"  ; xaxis string
  res at tiYAxisString = "Altitude (km)"                  ; yaxis string
;res at trYReverse        = True                       ; reverse Y-axis

  res at trYMinF     = -1 ; set minimum Y-axis value
  res at trYMaxF     =  10 ; set maximum Y-axis value
  res at trXMinF     = 0        ; set minimum X-axis value
  res at trXMaxF     = 0.06       ; set maximum X-axis value


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

res at gsnLeftString       = "Winter"         ; change left string
plot(0) = gsn_csm_xy(wks,extinct_winter_avg2,alt,res)
res at gsnLeftString       = "Spring"         ; change left string
plot(1) = gsn_csm_xy(wks,extinct_spring_avg2,alt,res)
res at gsnLeftString       = "Summer"         ; change left string
plot(2) = gsn_csm_xy(wks,extinct_summer_avg2,alt,res)
res at gsnLeftString       = "Fall"         ; change left string
plot(3) = gsn_csm_xy(wks,extinct_fall_avg2,alt,res)
;************************************************
; create panel
;************************************************
resP                  = True                    ; modify the panel plot

 resP at gsnPanelFigureStrings = (/"a)","b)","c)","d)"/)      ; add strings to
panel
 gsn_panel(wks,plot,(/2,2/),resP)


delete(plot)
delete(res)
delete(resP)
delete(wks)




Thanks,
Ana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170329/fdd0528a/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vertical_whole.eps
Type: application/postscript
Size: 386905 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170329/fdd0528a/attachment-0001.eps 


More information about the ncl-talk mailing list