<div dir="ltr"><div><div>Hi Debasish,<br></div>Try the following:<br><br><br>begin<br> arr = (/2569,7000,12.25,81.65,58.8/)<br> minval = (/541,2190,7.83,49.33,38.88/)<br> maxval = (/4006,10456,19.34,137.7,77.42/)<br><br> wks_type = "x11"<br> wname = "bar"<br> wks = gsn_open_wks(wks_type,wname)<br>;************************************************<br>; create panel plots<br>;*************************************************<br> res = True<br> res@gsnDraw = False<br> res@gsnFrame = False<br> res@gsnXYBarChart = True ; plot mods desired<br> res@trYMinF = 0<br> res@trYMaxF = max(maxval)+0.1*max(maxval)<br> lres = True ; polyline mods desired<br> lres@gsLineColor = "black"<br> lres@gsLineThicknessF = 2.5 ; thickness of lines<br> lres@gsLineDashPattern = 0<br> lres@gsLineColor = "gray50"<br><br> plot = gsn_csm_xy(wks,ispan(1,5,1),arr,res)<br><br> dum = new(dimsizes(arr),graphic)<br> x = ispan(1,5,1)<br> do n=0,dimsizes(dum)-1<br> dum(n) = gsn_add_polyline(wks,plot,(/x(n),x(n)/),(/minval(n),maxval(n)/),lres)<br> end do<br> draw(plot)<br> frame(wks)<br>;***********<br>end<br><br><br></div>Each y-error is drawn separately. There is also a simple function here for adding error bars (example 12):<br><a href="https://www.ncl.ucar.edu/Applications/Scripts/scatter_12.ncl"></a><div><br><a href="https://www.ncl.ucar.edu/Applications/scatter.shtml">https://www.ncl.ucar.edu/Applications/scatter.shtml</a><br><br><br></div><div>Cheers,<br></div><div>Rashed<br></div><div><br><br><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 9, 2018 at 10:56 AM, Debasish Hazra <span dir="ltr"><<a href="mailto:debasish.hazra5@gmail.com" target="_blank">debasish.hazra5@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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 ? </div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/shea_util.ncl"<br>;*****************************<wbr>***************<br>begin</div><div> arr = (/2569,7000,12.25,81.65,58.8/)<br> minval = (/541,2190,7.83,49.33,38.88/)<br> maxval = (/4006,10456,19.34,137.7,77.<wbr>42/)</div><div><br></div><div> wks_type = "png"<br> wname = "bar"<br> wks = gsn_open_wks(wks_type,wname)</div><div>;*****************************<wbr>*******************<br>; create panel plots<br>;*****************************<wbr>********************</div><div> res = True<br> res@gsnDraw = False<br> res@gsnFrame = False<br> res@gsnXYBarChart = True ; plot mods desired<br> lres = True ; polyline mods desired<br> lres@gsLineColor = "black"<br> lres@gsLineThicknessF = 2.5 ; thickness of lines<br> lres@gsLineDashPattern = 0<br> lres@gsLineColor = "gray50"</div><div> </div><div> plot = gsn_csm_xy(wks,ispan(1,5,1),<wbr>arr,res)</div><div> dum = gsn_add_polyline(wks,plot,<wbr>minval,maxval,lres)</div><div> </div><div> draw(plot)<br> frame(wks)</div><div>;*****************************<wbr>***************<br>end</div><div><br></div><div>Thanks.</div><span class="HOEnZb"><font color="#888888"><div>Debasish</div></font></span></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>