<div dir="ltr">I tried <span style="white-space:pre-wrap">res@gsnDraw  = False, but it didn&#39;t work. here is my code:</span><div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap">m1 = &quot;No Aerosol&quot;
m2 = &quot;All Aerosols&quot;

line_col1 = &quot;red&quot;
line_col2 = &quot;blue&quot;
line_pat1 = 0          ; Solid
line_pat2 = 2          ; Dashed


 wks   = gsn_open_wks (&quot;eps&quot;,&quot;xy&quot;)                
;---Set plotting parameters
res                   = True

res@gsnDraw  = False       ; don&#39;t draw the plots now
res@gsnFrame = False       ; or advance the frame

res@tmYROn             = False        ; Don&#39;t draw labels for
res@tmYRLabelsOn       = False        ; right Y axes, b/c left

res@xyDashPattern  = 0                         ; Make curves all solid
res@xyLineColors      = (/&quot;blue&quot;,&quot;red&quot;,&quot;green&quot;/)          ; change line color
res@tiMainString      = &quot;Vertical profile of atmospheric heating rate&quot;             ; add title
res@tiXAxisString = &quot;Atmospheric heating (K/day)&quot;  ; xaxis string
res@tiYAxisString = &quot;Pressure levels (hPa)&quot;                  ; yaxis string
res@trYReverse        = True                       ; reverse Y-axis

res@trYMinF     = 0                 set minimum Y-axis value
res@trYMaxF     =  1200                 set maximum Y-axis value
res@trXMinF     = -0.5      ; set minimum X-axis value
res@trXMaxF     = 1.2      ; set maximum X-axis value


plot  = gsn_csm_xy (wks,data2,lev2,res) ; create plot
;
; Draw some text and lines to create a legend.
;
    res_text               = True
    res_text@txFontHeightF = 0.015
    res_text@txJust        = &quot;CenterLeft&quot;

    res_lines                   = True        ; polyline mods desired
    res_lines@gsLineColor       = line_col1   ; line color
    res_lines@gsLineThicknessF  = 3           ; line thicker
    res_lines@gsLineDashPattern = line_pat1   ; dash pattern

    xx = (/1893,1907/)
    yy = (/0.705,0.705/)
    gsn_polyline(wks,plot,xx,yy,res_lines)
    gsn_text(wks,plot,m1,1900,53.,res_text)

    yy = (/0.79,0.79/)
    res_lines@gsLineColor       = line_col2   ; line color
    res_lines@gsLineDashPattern = line_pat2   ; dash pattern
    gsn_polyline(wks,plot,xx,yy,res_lines)
    gsn_text(wks,plot,m2,1900,52.5,res_text)

draw(plot)

delete(wks)

</span></div><div><span style="white-space:pre-wrap">Thanks,</span></div><div><span style="white-space:pre-wrap">Ana</span></div><div><span style="white-space:pre-wrap"><br></span></div><div><span style="white-space:pre-wrap"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 9, 2017 at 8:40 AM, Rick Brownrigg <span dir="ltr">&lt;<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.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>HI,<br><br></div><div>Normally, when you make calls that return a plot object, such as gsn_csm_xy(), the plot is generated and drawn immediately.  If you want to further annotate the plot with polylines or text, etc, you have to suppress this auto-draw:<br><pre> res@gsnDraw  = False       ; don&#39;t draw the plots now
 res@gsnFrame = False       ; or advance the frame<br> ...<br></pre><pre> plot = gsn_csm_xy(wks, ...., res)<br> ...<br></pre><pre> gsn_ployline(...)<br></pre><pre> gsn_text(...)<br></pre><pre> ...etc...<br></pre><pre> draw(plot)    ; now explicitly draw the plot<br></pre><pre> frame(wks)    ; advance workstaton to next page/window/image<br> ...<br><br></pre><pre>Make sense?<br></pre><pre>Rick<br></pre></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Feb 8, 2017 at 6:37 PM, Anahita Amiri Farahani <span dir="ltr">&lt;<a href="mailto:aamir003@ucr.edu" target="_blank">aamir003@ucr.edu</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi All,<div><br></div><div>Here is my code to add legend and text to the plot, but it does not work:</div><div><br></div><div><br></div><div><div><br></div><div>m1 = &quot;ccsm3_bgc4_I_11b&quot;</div><div>m2 = &quot;b30.061cb&quot;</div><div><br></div><div>line_col1 = &quot;red&quot;</div><div>line_col2 = &quot;blue&quot;</div><div>line_pat1 = 0          ; Solid</div><div>line_pat2 = 2          ; Dashed</div><div><br></div><div><br></div><div> wks   = gsn_open_wks (&quot;eps&quot;,&quot;xy&quot;)                </div><div>;---Set plotting parameters</div><div> res                   = True    </div><div>res@xyDashPattern  = 0                         ; Make curves all solid</div><div>res@xyLineColors      = (/&quot;blue&quot;,&quot;red&quot;,&quot;green&quot;/)          ; change line color</div><div>res@tiMainString      = &quot;Vertical profile of atmospheric heating rate&quot;             ; add title</div><div>res@tiXAxisString = &quot;Atmospheric heating (K/day)&quot;  ; xaxis string</div><div>res@tiYAxisString = &quot;Pressure levels (hPa)&quot;                  ; yaxis string</div><div>res@trYReverse        = True                       ; reverse Y-axis</div><div><br></div><div>res@trYMinF     = 0<span class="m_-8394480899293127880m_-1772966832140042752gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>; set minimum Y-axis value</div><div>res@trYMaxF     =  1200<span class="m_-8394480899293127880m_-1772966832140042752gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>; set maximum Y-axis value</div><div>res@trXMinF     = -0.5      ; set minimum X-axis value</div><div>res@trXMaxF     = 1.2      ; set maximum X-axis value</div><div><br></div><div><br></div><div>plot  = gsn_csm_xy (wks,data2,lev2,res) ; create plot</div><div>;</div><div>; Draw some text and lines to create a legend.</div><div>;</div><div>    res_text               = True</div><div>    res_text@txFontHeightF = 0.015</div><div>    res_text@txJust        = &quot;CenterLeft&quot;</div><div><br></div><div>    res_lines                   = True        ; polyline mods desired</div><div>    res_lines@gsLineColor       = line_col1   ; line color</div><div>    res_lines@gsLineThicknessF  = 3           ; line thicker</div><div>    res_lines@gsLineDashPattern = line_pat1   ; dash pattern</div><div><br></div><div>  xx = (/1893,1907/)</div><div>  yy = (/0.705,0.705/)</div><div>    gsn_polyline(wks,plot,xx,yy,re<wbr>s_lines)</div><div>    gsn_text(wks,plot,m1,1900,53.,<wbr>res_text)</div><div><br></div><div>  yy = (/0.79,0.79/)</div><div>    res_lines@gsLineColor       = line_col2   ; line color</div><div>    res_lines@gsLineDashPattern = line_pat2   ; dash pattern</div><div>    gsn_polyline(wks,plot,xx,yy,re<wbr>s_lines)</div><div>    gsn_text(wks,plot,m2,1900,52.5<wbr>,res_text)</div><div> </div><div><br></div><div>delete(wks)</div><div><br></div><div><br></div></div><div><br></div><div><br></div><div><br></div><div>Thank you,</div><div>Ana</div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>