<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi</p>
<p>I wasn't getting the correct legend when plotting 2 timeseries
using <b>gsn_csm_xy2</b> as I just get one title. If I plot using
the same y axis using <b>gsn_csm_xy</b><b>,</b> I get both
titles. Is it possible to use legend when using gsn_csm_xy2 or so
I need to creat the legend more explicitly? Sample code is below
that replicates issue. <br>
</p>
<p>Cathy<br>
</p>
<p><br>
</p>
<p>; NCL test code</p>
<p>; set ixy2 to 0 to get other plot<br>
</p>
<p>ixy2=1</p>
<p>key_title1="AAAAA"<br>
key_title2="BBBBB"<br>
wks = gsn_open_wks("png","outfile") ; open a ncgm file<br>
res2 = True<br>
res = True<br>
res@xyExplicitLegendLabels = (/key_title1,key_title2/) ;
explicit labels<br>
ndata = new((/2,100/),float)<br>
<br>
xinteger = ispan (1,100,1)<br>
y1 = fspan(100,199,100)<br>
y2 = fspan(150,249,100)<br>
ndata(0,:)=y1<br>
ndata(1,:)=y2<br>
res@pmLegendDisplayMode = "Always" ; turn on legend<br>
res@pmLegendHeightF = 0.04 ; height of
legend.<br>
<br>
if(ixy2.eq.1)then<br>
plot = gsn_csm_xy2(wks,xinteger,y1,y2,res,res2)<br>
else<br>
plot = gsn_csm_xy(wks,xinteger,ndata(:,:),res)<br>
end if<br>
<br>
</p>
<pre class="moz-signature" cols="72">--
----------------------------------------------
NOAA/ESRL PSD and CU CIRES
303-497-6263
<a class="moz-txt-link-freetext" href="https://www.esrl.noaa.gov/psd/people/cathy.smith/">https://www.esrl.noaa.gov/psd/people/cathy.smith/</a>
Emails about data/webpages may get quicker responses from emailing
<a class="moz-txt-link-abbreviated" href="mailto:esrl.psd.data@noaa.gov">esrl.psd.data@noaa.gov</a></pre>
</body>
</html>