<div dir="ltr"><div class="gmail_default" style="font-size:small">There are a few things wrong with your code:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><ul><li>First, be sure to pay attention to any warnings or error messages coming out of NCL, as this may indicate what the problem is. I don&#39;t think your code should even be running as written, because you have some errors, which is my next bullet item:<br><br></li><li>gsn_add_polyline is a function, hence it needs to return a value:<br></li></ul></div><div class="gmail_default" style><div style="font-size:small">id = gsn_add_polyline(....)</div><div style="font-size:small"><br></div><div style><ul style><li style>I recommend adding the polyline to the plot before you overlay it, because the nature of the plots change once they&#39;ve been passed to the &quot;overlay&quot; call.<br><br></li><li style>If a reference line is not showing up in a plot, it&#39;s likely because the values being used to draw the line are not in the same data space as the plot you are attaching it to. <br><br></li><li style>I don&#39;t understand the coordinates of your line:</li></ul><div><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">  xb0 =  (/0.4,0.4,0.4,0.4,0.4/)</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"> yb0 =  (/0.,0.,9.0,9.0,0.0/)</span><br></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">The X values are all the same, which indicates you are trying to draw a vertical line. If this is the case, then you only need:</span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">xb0   = (/0.4,0.4/)</span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">yb0  = (/0, 9.0/)</span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><ul><li><span style="color:rgb(80,0,80);font-family:arial,sans-serif">Really, though, if you just need an X reference line, then see the special &quot;gsnXRefLine&quot; resource.</span><br></li></ul></div><div><font color="#500050" face="arial, sans-serif"><br></font></div><div><font color="#500050" face="arial, sans-serif"><a href="http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnXRefLine">http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnXRefLine</a><br></font></div><div><font color="#500050" face="arial, sans-serif"><br></font></div><div><font color="#500050" face="arial, sans-serif">Please check all these issues and fix them.  If you still have problems, it will help if you can provide the code and the data.</font></div><div><font color="#500050" face="arial, sans-serif"><br></font></div><div><font color="#500050" face="arial, sans-serif">Thanks,</font></div><div><font color="#500050" face="arial, sans-serif"><br></font></div><div><font color="#500050" face="arial, sans-serif">--Mary</font></div><div><font color="#500050" face="arial, sans-serif"><br></font></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 13, 2014 at 6:17 PM, Hyacinth Nnamchi <span dir="ltr">&lt;<a href="mailto:hyacinth.1@hotmail.com" target="_blank">hyacinth.1@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">


<div><div dir="ltr">Hi,<br><br>I am trying to attach polyline to indicate some reference values in bar plots. The script runs without any error message and the bar chart plotted but without the polyline. The plot and script are attached. I appreciate any suggestions in advance.<br><br>Thanks,<br><br>Hyacinth<br><br>  sres = True<br>     sres@vpWidthF = 0.7<br>     sres@vpHeightF = 0.5<br>  ;   sres@trYLog = True <br>     sres@vpXF = .15<br>     sres@trXMinF = 0.4<br>     sres@trXMaxF = 9.6<br>     sres@trYMinF = -1.0<br>     sres@trYMaxF = 1.0<br>     sres@gsnYRefLine           = 0.0            ; create a reference line   <br>     sres@trXReverse            = True     ; Reverse X axis values<br>     sres@gsnDraw = True<br>     sres@gsnFrame = False<br>     sres@tmXBLabelsOn  = True<br>     sres@gsnXYBarChart = True<br>     sres@gsnXYBarChartBarWidth = 0.15           ; change bar widths<br>     sres@tmXBMode          = &quot;Explicit&quot;         ; explicit labels<br>     sres@tmXBValues        = (/1,2,3,4,5,6,7,8,9/)<br>     ;  sres@tmXBLabelDeltaF      = -45.0<br>     sres@tmXBLabelAngleF         = 90.<br>   ;  sres@tmXBDataLeftF           =  0.2<br>     sres@tmXBMajorOutwardLengthF = 0.0               ; draw tickmarks inward<br>     sres@tmXBMinorOutwardLengthF = 0.0               ; draw minor ticsk inward<br>     sres@tmYLMajorOutwardLengthF = 0.0               ; draw tickmarks inward<br>     sres@tmYLMinorOutwardLengthF = 0.0               ; draw minor ticsk inward<br>     sres@tmXBLabelFontHeightF = 0.0150<br>     sres@tmXTLabelFontHeightF = 0.0205<br>     sres@tmYLLabelFontHeightF = 0.0225<br>     sres@tiMainFontHeightF = 0.025<br>     sres@tiMainFont = &quot;helvetica&quot;<br>     sres@tiMainString = &quot;&quot;<br>     sres@gsnRightString = &quot;&quot;<br>     sres@tiYAxisString = &quot;Correlation between (u&#39;&lt;MAM&gt;) and (SST&#39;&lt;JJA&gt;)&quot;<br>     sres@tiYAxisFontHeightF = 0.015<br>        <br>     sres@gsnXYBarChartColors = (/&quot;blue&quot;/)    <br>     plot1 = gsn_csm_xy(wks,fspan(.775,8.775,9),rCL(0,:),sres)        ; draw each timeseries<br>     sres@gsnXYBarChartColors = (/&quot;lightpink&quot;/)                    ; seperately, not<br>     plot2 = gsn_csm_xy(wks,fspan(.925,8.905,9),rCL(1,:),sres)        ; advancing the frame<br>    overlay(plot1,plot2)<br>    plot(0) = plot1<br>;====================================================================<br>;========================================================================<br>;========================================================================<br>;========================================================================<br>; Create and add polylines @ 0.4<br>;========================================================================<br>;========================================================================<br>  xb0 =  (/0.4,0.4,0.4,0.4,0.4/)<br> yb0 =  (/0.,0.,9.0,9.0,0.0/)<br>;========================================================================<br>;---Resources for the polyline<br>  pres0                  = True           ; polyline mods desired<br>  pres0@gsLineThicknessF = 3.            ; line thickness <br>  pres0@gsLineColor      = &quot;black&quot;         ; color of lines<br>  pres0@gsLineDashPattern = 2<br><br>;---Attach the polyline<br> <br>  gsn_add_polyline(wks,plot(0),xb0,yb0,pres0)          ; <br>;**********************************************************<br>; add text labels<br>;**********************************************************  <br>  txres                     = True                 ; text mods desired<br>  txres@txFontHeightF       = 0.018                ; default size is HUGE!<br> ; txres@txAngleF            = 52.                  ; text angle<br>  txres@txJust              = &quot;CenterLeft&quot;         ; puts text on top of bars<br>  <br>;====================================================================<br>     lbres                    = True         ; labelbar only resources<br>     lbres@lbAutoManage       = False<br>     lbres@vpWidthF           = 0.05          ; labelbar width<br>     lbres@vpHeightF          = 0.08           ; labelbar height<br>     lbres@lbBoxMajorExtentF  = 0.15          ; puts space between color boxes<br>     lbres@lbFillColors       = (/&quot;blue&quot;,&quot;lightpink&quot;/)<br>     lbres@lbMonoFillPattern  = True          ; Solid fill pattern<br>     lbres@lbLabelFontHeightF = 0.015         ; font height. default is small<br>     lbres@lbLabelJust        = &quot;TopLeft&quot;  ; left justify labels<br>     lbres@lbPerimOn          = False<br>     lbres@lgPerimColor      = &quot;white&quot;<br>     labels = (/&quot;Full-CGCM&quot;,&quot;Slab-CGCM&quot;/)<br>     gsn_labelbar_ndc(wks,1,labels,0.19,0.40,lbres)    ; draw right labelbar column<br>    <br>     lbres@lbFillColors       = (/&quot;lightpink&quot;,&quot;blue&quot;/)<br>     labels = (/&quot;Slab-CGCM&quot;,&quot;Full-CGCM&quot;/)<br>     gsn_labelbar_ndc(wks,1,labels,0.50,0.40,lbres)    ; draw right labelbar column<br>    ; labels = (/&quot;CCSM2 (T42)&quot;,&quot;OBS        &quot;/)<br>    ; gsn_labelbar_ndc(wks,2,labels,0.17,0.23,lbres)    ; draw left labelbar column<br>;==============================================================<br>frame(wks)<br><br><br>                                               </div></div>
</div></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>