<div dir="ltr"><div class="gmail_default" style="font-size:small">Ipsita,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">In order to overlay a bunch of bar charts, it works best if you can shift each of the bars by a certain bar width, and then you can draw them side-by-side. I think you may have used part of bar_11.ncl on our bar examples page, and this is a good one to work with. However, you want to add some overlay code in there, which will make all the plots part of the same plot.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The key is to draw each set of bars with a slightly shifted set of X values, so the bars are drawn next to each other.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See the attached example and script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">
--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 1, 2014 at 4:27 PM, Ipshita Majhi <span dir="ltr"><<a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</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><div>Hi,<br></div>I want to plot trend values and monthly means in one plot. Both are an array of size 12 .<br>
</div>The program gives no error but the plot are overlapping. I am not sure how to fix it. I realized that if I use the below mentioned method they overlap is there a way to have two y axis in bar plots. Since the trends are much smaller then avgs.<br>
<br>;*****************************************************<br>;Trend and monthly climatology together in one bar plot<br>;*******************************************************<br> <br> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br> <br> months=(/1,2,3,4,5,6,7,8,9,10,11,12/)<br><br> monthly_avg=asciiread("~/Documents/PhD_June_2015/NCL_Moonsoon/Data_output/Monthly_avg_air.txt",-1, "float")<br>
monthly_Trend=asciiread("~/Documents/PhD_June_2015/NCL_Moonsoon/Data_output/trend_air.txt", -1, "float")<br> printVarSummary(monthly_avg)<br> <br> wks = gsn_open_wks("ps","Trend_Avg")<br>
<br> <br> sres = True<br> sres@vpWidthF = 0.7<br> sres@vpHeightF = 0.5<br> sres@gsnDraw = True<br> sres@gsnFrame = False<br> sres@gsnXYBarChart = True<br> sres@gsnXYBarChartBarWidth = 0.15 ; change bar widths<br>
sres@tmXBMode = "Explicit" ; explicit labels<br> sres@tmXBValues = (/1,2,3,4,5,6,7,8,9,10,11,12/)<br> sres@tmXBLabels = (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"/)<br>
sres@tmXBLabelFontHeightF = 0.0205<br> sres@tmXTLabelFontHeightF = 0.0205<br> sres@tmYLLabelFontHeightF = 0.0225<br> sres@tiMainFontHeightF = 0.025<br> sres@tiMainFont = "helvetica"<br> sres@tiMainString = "All India Rainfall Climatology and Trend 1880-2012"<br>
sres@tiYAxisString = "(mm)"<br><br> plot1 = gsn_csm_xy (wks,months,monthly_avg,sres) <br> sres@gsnXYBarChartColors = (/"red"/) ; seperately, not<br> plot2 = gsn_csm_xy(wks,months,monthly_Trend,sres) ; advancing the frame<br>
sres@gsnXYBarChartColors = (/"blue"/) ; but tweaking where<br> <br></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>