[ncl-talk] Two bar in one plot

Adam Phillips asphilli at ucar.edu
Fri Aug 1 16:13:25 MDT 2014


Hi Ipshita,
Take a look at example #9 here:
http://www.ncl.ucar.edu/Applications/bar.shtml#ex9

You will want to adjust your months array in your two
gsn_csm_xy calls to be different from one another as it is done in the
example.  Otherwise your bars will overlap.

Good luck,
Adam


On Fri, Aug 1, 2014 at 3:56 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:

> Hi,
> I want to plot trend values and monthly means in one plot. Both are an
> array of size 12 .
> The program gives no error but the plot are overlapping. I am not sure how
> to fix it
> ;*****************************************************
> ;Trend and monthly climatology together in one bar plot
> ;*******************************************************
>
>      load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>      load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
>      months=(/1,2,3,4,5,6,7,8,9,10,11,12/)
>
>
> monthly_avg=asciiread("~/Documents/PhD_June_2015/NCL_Moonsoon/Data_output/Monthly_avg_air.txt",-1,
> "float")
>
> monthly_Trend=asciiread("~/Documents/PhD_June_2015/NCL_Moonsoon/Data_output/trend_air.txt",
> -1, "float")
>      printVarSummary(monthly_avg)
>
>      wks = gsn_open_wks("ps","Trend_Avg")
>
>
>      sres = True
>      sres at vpWidthF = 0.7
>      sres at vpHeightF = 0.5
>      sres at gsnDraw = True
>      sres at gsnFrame = False
>      sres at gsnXYBarChart = True
>      sres at gsnXYBarChartBarWidth = 0.15           ; change bar widths
>      sres at tmXBMode          = "Explicit"         ; explicit labels
>      sres at tmXBValues        = (/1,2,3,4,5,6,7,8,9,10,11,12/)
>      sres at tmXBLabels =
> (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"/)
>      sres at tmXBLabelFontHeightF = 0.0205
>      sres at tmXTLabelFontHeightF = 0.0205
>      sres at tmYLLabelFontHeightF = 0.0225
>      sres at tiMainFontHeightF = 0.025
>      sres at tiMainFont = "helvetica"
>      sres at tiMainString = "All India Rainfall Climatology and Trend
> 1880-2012"
>      sres at tiYAxisString = "(mm)"
>
>      plot1 = gsn_csm_xy (wks,months,monthly_avg,sres)
>      sres at gsnXYBarChartColors = (/"red"/)                    ;
> seperately, not
>      plot2 = gsn_csm_xy(wks,months,monthly_Trend,sres)
>                ; advancing the frame
>      sres at gsnXYBarChartColors = (/"blue"/)                    ; but
> tweaking where
>
>
>      ;*******************************************************
>
> Can someone suggest what steps to take
> Ipshita
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Division, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140801/c16a2af9/attachment.html 


More information about the ncl-talk mailing list