<div dir="ltr">Hi Katie,<div>Over the years I have transitioned from using gsn_histogram for binning/plotting to using it only for the binning and then plotting things myself using gsn_csm_xy. The latter method allows easier customization than using gsn_histogram on its&#39; own. I would think this method would be best for the type of plot you are after.</div><div><br></div><div>Here&#39;s some example code:</div><div>; use gsn_histogram to bin the data and set x-axis coordinates</div><div><div>  hres = True     </div><div>  hres@gsnDraw = False</div><div>  hres@gsnFrame = False</div><div>  </div><div>  hres@gsnHistogramBinIntervals = fspan(-.8,.8,17)</div><div>  plot = gsn_histogram(wks,control,hres)</div><div>  fin_rt_ctl = plot@NumInBins*1.</div><div>  fin_rt_ctl!0 = &quot;time&quot;</div><div>  fin_rt_ctl&amp;time = fspan(-.75,.75,16) ; assign where on x-axis bins </div></div><div>                                                     ; are centered.</div><div>  delete(plot)</div><div><br></div><div>  plot = gsn_histogram(wks,sim0,hres)</div><div><div>  fin_rt_sim0 = plot@NumInBins*1.</div><div>  fin_rt_sim0!0 = &quot;time&quot;</div><div>  fin_rt_sim0&amp;time = fspan(-.7,.8,16) ; assign where on x-axis bins </div></div><div>                                                     ; are centered, shifting from control</div><div>  delete(plot)                                   ; time set above</div><div><br></div><div>; next, set up the plot resources for the bar chart plot.</div><div><br></div><div><div>  res = True</div><div>  res@gsnDraw = False</div><div>  res@gsnFrame = False</div><div>  res@gsnYRefLine = 0.0</div><div><div>  res@gsnXYBarChart = True</div><div>  res@trYMinF = 0.0</div></div></div><div>  res@trXMinF = -.9</div><div>  res@trXMaxF = .9</div><div>  res@gsnXYBarChartBarWidth = 0.04 ; set bar widths</div><div><br></div><div>  res@gsnXYBarChartColors = (/&quot;black&quot;/)</div><div>  plot = gsn_csm_xy(wks,fin_rt_ctl&amp;time,fin_rt_ctl,res)</div><div><br></div><div>  res@gsnXYBarChartColors = (/&quot;blue&quot;/)</div><div>  plot2 = gsn_csm_xy(wks,fin_rt_sim0&amp;time,fin_rt_sim0,res)</div><div>  overlay(plot,plot2)</div><div>  draw(plot)</div><div>  frame(wks)</div><div><br></div><div>The above should at least get you started on what you need to do. You will likely want to set the x-axis tick marks explicitly as well. (See the bottom panel coding of example number two here:</div><div><a href="http://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex2">http://www.ncl.ucar.edu/Applications/tickmarks.shtml#ex2</a> )<br></div><div><br></div><div>Hope that helps. If you have any further questions please respond to the ncl-talk email list.</div><div>Adam</div><div><br></div><div><br></div><div><br></div><div>  </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 12, 2017 at 9:14 AM, Dagon, Katie <span dir="ltr">&lt;<a href="mailto:kdagon@fas.harvard.edu" target="_blank">kdagon@fas.harvard.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
<br>
Does anyone know how to plot 2 histograms side by side instead of overlapping (as is done by default with the gsnHistogramCompare function)?<br>
I have tried using &quot;res@gsnHistogramSideBySide = True”, however that shifts the distributions slightly to the left, so the values do not line up with the correct labels on the x axis. I have not been able to determine why this happens, though it may be that SideBySide assumes it will have at least 3 datasets, instead of 2.<br>
<br>
Ideally, I would like the distributions to sit side by side with some white space on either side of the x axis tick marks.<br>
<br>
Thanks in advance for any help. I have attached two plot examples when using histogram compare versus sidebyside. The compare figure shows the data in its correct position with respect to the x axis, and the side-by-side figure is shifted to the left. I am using NCL version 6.2.1.<br>
<span class="HOEnZb"><font color="#888888"><br>
Katie<br>
<br>
</font></span><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><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>