<div dir="ltr">Thank you<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 5, 2014 at 3:38 PM, Ipshita Majhi <span dir="ltr">&lt;<a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</a>&gt;</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><br>I am trying to plot two bar plots in one common plot<br></div>Here is the code. The error is gsn_open_wks is undefined. How do I approach this problem.<br>
</div>Thank you in advance<br><div>
<div><br><br>;Trend and monthly Climatology together<br>;load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br><br>months=(/1,2,3,4,5,6,7,8,9,10,11,12/)<br>

x=asciiread(&quot;~/Documents/PhD_June_2015/NCL_Moonsoon/Data_output/Trend_monthly.txt&quot;,(/12,2/), &quot;float&quot;)<br><br>print(x)<br><br>begin<br>     npts   = 12<br>     nplots = 2<br>     <br>;<br>; Define the x values for each set of bars to be slightly shifted<br>

; so the bars don&#39;t overlap. The bars are shifted by 0.15 each<br>; which is what we&#39;ll use for the bar width later.<br>;<br>     ii        = ispan(0,npts-1,1)<br>     bar_width = 0.15<br>     xarr      = new((/nplots,npts/),float)<br>

     do i=0,nplots-1<br>       xarr(i,:) = ii+0.775 + (i*bar_width)<br>     end do<br><br>     colors           = (/&quot;red&quot;,&quot;lightblue&quot;/)<br>     wks=gsn_open_wks(&quot;png&quot;,&quot;bar&quot;)<br><br>

     sres = True<br>     sres@gsnDraw               = False<br>     sres@gsnFrame              = False<br><br>     sres@vpWidthF              = 0.7<br>     sres@vpHeightF             = 0.5<br><br>     sres@trXMinF               = min(xarr)-0.5    ; Leave some space before<br>

     sres@trXMaxF               = max(xarr)+0.5    ; and after bars.<br>     sres@trYMinF               = 0.0<br>     sres@trYMaxF               = max(stdarr)+.1   ; Leave some space at top<br><br>     sres@gsnXYBarChart         = True<br>

     sres@gsnXYBarChartBarWidth = bar_width        ; make bar width smaller, otherwise<br>                                                   ; they will overlap<br><br>     sres@tmXBMode              = &quot;Explicit&quot;         ; explicit labels<br>

     sres@tmXBValues            = ispan(1,12,1)<br>     sres@tmXBLabels            = (/&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;,&quot;Sep&quot;, \<br>

                                    &quot;Oct&quot;,&quot;Nov&quot;,&quot;Dec&quot;/)<br><br>     sres@tmXBLabelFontHeightF  = 0.0205<br>     sres@tmXTLabelFontHeightF  = 0.0205<br>     sres@tmYLLabelFontHeightF  = 0.0225<br>

<br>     sres@gsnRightString        = &quot;&quot;<br>     sres@tiYAxisString         = &quot;Precipitation in mm&quot;<br>        <br>;<br>; Loop through each plot, create it, and then overlay<br>; subsequent ones one the first one.<br>

;<br>     plots = new(nplots,graphic)<br>     do i=0,1<br>       sres@gsnXYBarChartColors = colors(i)<br>       plots(i) = gsn_csm_xy(wks,xarr(i,:),x(:,i),sres)<br><br>       if(i.gt.0) then<br>         overlay(plots(0),plots(i))<br>

       end if<br>     end do<br><br>;---Drawing plots(0) will also draw all the overlaid plots.<br>    draw(plots(0))<br><br><br>     frame(wks)   ; Advance the frame.<br>end<br></div></div></div>
</blockquote></div><br></div>