[ncl-talk] showing range in bar plot

Debasish Hazra debasish.hazra5 at gmail.com
Fri Mar 9 11:56:53 MST 2018


I am trying to do a barplot with vertical error bars that will show the
range. But the figure shows bars only, with any error bars associated. What
is needed to add error bars in the figure ?

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;********************************************
begin
     arr =    (/2569,7000,12.25,81.65,58.8/)
     minval = (/541,2190,7.83,49.33,38.88/)
     maxval = (/4006,10456,19.34,137.7,77.42/)

 wks_type = "png"
 wname = "bar"
   wks = gsn_open_wks(wks_type,wname)
;************************************************
; create panel plots
;*************************************************
  res            = True
  res at gsnDraw  = False
  res at gsnFrame = False
  res at gsnXYBarChart = True                 ; plot mods desired
  lres                   = True                    ; polyline mods desired
  lres at gsLineColor       = "black"
  lres at gsLineThicknessF  = 2.5                     ; thickness of lines
  lres at gsLineDashPattern = 0
  lres at gsLineColor       = "gray50"

   plot = gsn_csm_xy(wks,ispan(1,5,1),arr,res)
   dum = gsn_add_polyline(wks,plot,minval,maxval,lres)

 draw(plot)
  frame(wks)
;********************************************
end

Thanks.
Debasish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180309/9fc3b7d0/attachment.html>


More information about the ncl-talk mailing list