<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="gmail-Apple-tab-span" style="white-space:pre">                </span>; set minimum Y-axis value</div><div>res@trYMaxF     =  1200<span class="gmail-Apple-tab-span" style="white-space:pre">                </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,res_lines)</div><div>    gsn_text(wks,plot,m1,1900,53.,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,res_lines)</div><div>    gsn_text(wks,plot,m2,1900,52.5,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>