Open CathySmithNOAA opened 5 years ago
Hi Cathy,
I took a look at this yesterday and could find no reason this is happening. I agree with your assessment however -- I would think that both titles should be plotted with gsn_csm_xy2.
That said, is gsn_csm_xy a suitable work around? Or is there some aspect of xy2's behavior that would otherwise make it preferable?
Rick
On Tue, May 14, 2019 at 8:20 AM Cathy Smith notifications@github.com wrote:
I am not getting the correct legend when plotting 2 timeseries using gsn_csm_xy2 as I just get one title. If I plot using the same y axis using gsn_csm_xy, I get both titles. I should not get one title. I should ideally get 2. If not I should get 0. Is this fixable?
Provide the following: Code:
key_title1="AAAAA" key_title2="BBBBB" wks = gsn_open_wks("png","outfile") ; open a ncgm file res2 = True res= True res@xyExplicitLegendLabels = (/key_title1,key_title2/) ; explicit labels ndata = new((/2,100/),float)
xinteger = ispan (1,100,1) y1 = fspan(100,199,100) y2 = fspan(150,249,100) ndata(0,:)=y1 ndata(1,:)=y2 res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendHeightF = 0.04 ; height of legend.
if(ixy2.eq.1)then plot = gsn_csm_xy2(wks,xinteger,y1,y2,res,res2) else plot = gsn_csm_xy(wks,xinteger,ndata(:,:),res) end if
run:
ncl 'ixy2=1' < test.xy.short.ncl or ncl 'ixy2=0' < test.xy.short.ncl
[image: outfile] https://user-images.githubusercontent.com/29237364/57705291-c9e88280-7620-11e9-9c33-78d18c6dadc0.png [image: outfile2] https://user-images.githubusercontent.com/29237364/57705292-c9e88280-7620-11e9-80fa-75d6c9739cb7.png
Computing environment NCAR Command Language Version 6.5.0 I didn't install it. Linux 2.6.32-754.11.1.el6.x86_64 x86_64
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NCAR/ncl/issues/97?email_source=notifications&email_token=ADLWOXXXEY3F4CTMD4TB6E3PVLDCHA5CNFSM4HM2OEAKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GTWBLXQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ADLWOXSHCMOCCZDOYWSTYYLPVLDCHANCNFSM4HM2OEAA .
Perhaps I am just misunderstanding but I am using the xy2 when I have a plot with different y axes for 2 time-series. I use the other when I am using the same y-axis for 2 time-series. If I could plot the 2-yaxes plot not using xy2, that would probably work for me.
See
https://www.esrl.noaa.gov/psd/cgi-bin/data/testdap/timeseries.pl
(I tried using the explicit legend call for xy2 but my code kept failing when I had draw(plot) which I wasn't able to debug as I'm still trying to see an error message. I suspect this is my error. But, I would prefer to use the other method if at all possible.)
Cathy
On 5/14/19 9:11 AM, Rick Brownrigg wrote:
Hi Cathy,
I took a look at this yesterday and could find no reason this is happening. I agree with your assessment however -- I would think that both titles should be plotted with gsn_csm_xy2.
That said, is gsn_csm_xy a suitable work around? Or is there some aspect of xy2's behavior that would otherwise make it preferable?
Rick
On Tue, May 14, 2019 at 8:20 AM Cathy Smith notifications@github.com wrote:
I am not getting the correct legend when plotting 2 timeseries using gsn_csm_xy2 as I just get one title. If I plot using the same y axis using gsn_csm_xy, I get both titles. I should not get one title. I should ideally get 2. If not I should get 0. Is this fixable?
Provide the following: Code:
key_title1="AAAAA" key_title2="BBBBB" wks = gsn_open_wks("png","outfile") ; open a ncgm file res2 = True res= True res@xyExplicitLegendLabels = (/key_title1,key_title2/) ; explicit labels ndata = new((/2,100/),float)
xinteger = ispan (1,100,1) y1 = fspan(100,199,100) y2 = fspan(150,249,100) ndata(0,:)=y1 ndata(1,:)=y2 res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendHeightF = 0.04 ; height of legend.
if(ixy2.eq.1)then plot = gsn_csm_xy2(wks,xinteger,y1,y2,res,res2) else plot = gsn_csm_xy(wks,xinteger,ndata(:,:),res) end if
run:
ncl 'ixy2=1' < test.xy.short.ncl or ncl 'ixy2=0' < test.xy.short.ncl
[image: outfile]
https://user-images.githubusercontent.com/29237364/57705291-c9e88280-7620-11e9-9c33-78d18c6dadc0.png [image: outfile2]
https://user-images.githubusercontent.com/29237364/57705292-c9e88280-7620-11e9-80fa-75d6c9739cb7.png
Computing environment NCAR Command Language Version 6.5.0 I didn't install it. Linux 2.6.32-754.11.1.el6.x86_64 x86_64
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub
https://github.com/NCAR/ncl/issues/97?email_source=notifications&email_token=ADLWOXXXEY3F4CTMD4TB6E3PVLDCHA5CNFSM4HM2OEAKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GTWBLXQ, or mute the thread
https://github.com/notifications/unsubscribe-auth/ADLWOXSHCMOCCZDOYWSTYYLPVLDCHANCNFSM4HM2OEAA .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NCAR/ncl/issues/97?email_source=notifications&email_token=AG7CA5GGBT5FHFT6IO6N26DPVLJCVA5CNFSM4HM2OEAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVLZUHA#issuecomment-492280348, or mute the thread https://github.com/notifications/unsubscribe-auth/AG7CA5ADOMX7ZKULYRRNCELPVLJCVANCNFSM4HM2OEAA.
--
NOAA/ESRL PSD and CU CIRES 303-497-6263 https://www.esrl.noaa.gov/psd/people/cathy.smith/
Emails about data/webpages may get quicker responses from emailing esrl.psd.data@noaa.gov
Hi Cathy, You're right, gsn_csm_xy2 should be used when two timeseries have different y-axis ranges. Two legend items should be drawn. Assuming that this is bug, I have an alternative suggestion. You could use simple_legend (to draw a legend within the plot space) or simple_legend_ndc (to draw the legend anywhere on the frame, say, to the right of the X-axis "Date" title). Those two functions give you complete control over every item of the legend, unlike the built-in options. https://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend.shtml https://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend_ndc.shtml (Great web interface by the way!) Adam
On Tue, May 14, 2019 at 9:26 AM Cathy Smith notifications@github.com wrote:
Perhaps I am just misunderstanding but I am using the xy2 when I have a plot with different y axes for 2 time-series. I use the other when I am using the same y-axis for 2 time-series. If I could plot the 2-yaxes plot not using xy2, that would probably work for me.
See
https://www.esrl.noaa.gov/psd/cgi-bin/data/testdap/timeseries.pl
(I tried using the explicit legend call for xy2 but my code kept failing when I had draw(plot) which I wasn't able to debug as I'm still trying to see an error message. I suspect this is my error. But, I would prefer to use the other method if at all possible.)
Cathy
On 5/14/19 9:11 AM, Rick Brownrigg wrote:
Hi Cathy,
I took a look at this yesterday and could find no reason this is happening. I agree with your assessment however -- I would think that both titles should be plotted with gsn_csm_xy2.
That said, is gsn_csm_xy a suitable work around? Or is there some aspect of xy2's behavior that would otherwise make it preferable?
Rick
On Tue, May 14, 2019 at 8:20 AM Cathy Smith notifications@github.com wrote:
I am not getting the correct legend when plotting 2 timeseries using gsn_csm_xy2 as I just get one title. If I plot using the same y axis using gsn_csm_xy, I get both titles. I should not get one title. I should ideally get 2. If not I should get 0. Is this fixable?
Provide the following: Code:
key_title1="AAAAA" key_title2="BBBBB" wks = gsn_open_wks("png","outfile") ; open a ncgm file res2 = True res= True res@xyExplicitLegendLabels = (/key_title1,key_title2/) ; explicit labels ndata = new((/2,100/),float)
xinteger = ispan (1,100,1) y1 = fspan(100,199,100) y2 = fspan(150,249,100) ndata(0,:)=y1 ndata(1,:)=y2 res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendHeightF = 0.04 ; height of legend.
if(ixy2.eq.1)then plot = gsn_csm_xy2(wks,xinteger,y1,y2,res,res2) else plot = gsn_csm_xy(wks,xinteger,ndata(:,:),res) end if
run:
ncl 'ixy2=1' < test.xy.short.ncl or ncl 'ixy2=0' < test.xy.short.ncl
[image: outfile]
< https://user-images.githubusercontent.com/29237364/57705291-c9e88280-7620-11e9-9c33-78d18c6dadc0.png
[image: outfile2]
< https://user-images.githubusercontent.com/29237364/57705292-c9e88280-7620-11e9-80fa-75d6c9739cb7.png
Computing environment NCAR Command Language Version 6.5.0 I didn't install it. Linux 2.6.32-754.11.1.el6.x86_64 x86_64
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub
< https://github.com/NCAR/ncl/issues/97?email_source=notifications&email_token=ADLWOXXXEY3F4CTMD4TB6E3PVLDCHA5CNFSM4HM2OEAKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GTWBLXQ , or mute the thread
< https://github.com/notifications/unsubscribe-auth/ADLWOXSHCMOCCZDOYWSTYYLPVLDCHANCNFSM4HM2OEAA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/NCAR/ncl/issues/97?email_source=notifications&email_token=AG7CA5GGBT5FHFT6IO6N26DPVLJCVA5CNFSM4HM2OEAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVLZUHA#issuecomment-492280348>,
or mute the thread < https://github.com/notifications/unsubscribe-auth/AG7CA5ADOMX7ZKULYRRNCELPVLJCVANCNFSM4HM2OEAA .
--
NOAA/ESRL PSD and CU CIRES 303-497-6263 https://www.esrl.noaa.gov/psd/people/cathy.smith/
Emails about data/webpages may get quicker responses from emailing esrl.psd.data@noaa.gov
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NCAR/ncl/issues/97?email_source=notifications&email_token=AFBZH7JNYIX3K3O7HHGJQNLPVLK3RA5CNFSM4HM2OEAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVL3FSY#issuecomment-492286667, or mute the thread https://github.com/notifications/unsubscribe-auth/AFBZH7LU3ISCYDOJOLN6EPDPVLK3RANCNFSM4HM2OEAA .
-- Adam Phillips Associate Scientist, Climate and Global Dynamics Laboratory, NCAR www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
I tried simple_legend and I was able to get a legend drawn using gsn_csm_xy2. I haven't drawn the box around it yet but my legend includes both time series now. I'll try adding the box next.
Thanks for the suggestion!
Cathy
On 5/14/19 3:17 PM, Adam Phillips wrote:
Hi Cathy, You're right, gsn_csm_xy2 should be used when two timeseries have different y-axis ranges. Two legend items should be drawn. Assuming that this is bug, I have an alternative suggestion. You could use simple_legend (to draw a legend within the plot space) or simple_legend_ndc (to draw the legend anywhere on the frame, say, to the right of the X-axis "Date" title). Those two functions give you complete control over every item of the legend, unlike the built-in options. https://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend.shtml https://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend_ndc.shtml (Great web interface by the way!) Adam
On Tue, May 14, 2019 at 9:26 AM Cathy Smith notifications@github.com wrote:
Perhaps I am just misunderstanding but I am using the xy2 when I have a plot with different y axes for 2 time-series. I use the other when I am using the same y-axis for 2 time-series. If I could plot the 2-yaxes plot not using xy2, that would probably work for me.
See
https://www.esrl.noaa.gov/psd/cgi-bin/data/testdap/timeseries.pl
(I tried using the explicit legend call for xy2 but my code kept failing when I had draw(plot) which I wasn't able to debug as I'm still trying to see an error message. I suspect this is my error. But, I would prefer to use the other method if at all possible.)
Cathy
On 5/14/19 9:11 AM, Rick Brownrigg wrote:
Hi Cathy,
I took a look at this yesterday and could find no reason this is happening. I agree with your assessment however -- I would think that both titles should be plotted with gsn_csm_xy2.
That said, is gsn_csm_xy a suitable work around? Or is there some aspect of xy2's behavior that would otherwise make it preferable?
Rick
On Tue, May 14, 2019 at 8:20 AM Cathy Smith notifications@github.com wrote:
I am not getting the correct legend when plotting 2 timeseries using gsn_csm_xy2 as I just get one title. If I plot using the same y axis using gsn_csm_xy, I get both titles. I should not get one title. I should ideally get 2. If not I should get 0. Is this fixable?
Provide the following: Code:
key_title1="AAAAA" key_title2="BBBBB" wks = gsn_open_wks("png","outfile") ; open a ncgm file res2 = True res= True res@xyExplicitLegendLabels = (/key_title1,key_title2/) ; explicit labels ndata = new((/2,100/),float)
xinteger = ispan (1,100,1) y1 = fspan(100,199,100) y2 = fspan(150,249,100) ndata(0,:)=y1 ndata(1,:)=y2 res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendHeightF = 0.04 ; height of legend.
if(ixy2.eq.1)then plot = gsn_csm_xy2(wks,xinteger,y1,y2,res,res2) else plot = gsn_csm_xy(wks,xinteger,ndata(:,:),res) end if
run:
ncl 'ixy2=1' < test.xy.short.ncl or ncl 'ixy2=0' < test.xy.short.ncl
[image: outfile]
<
https://user-images.githubusercontent.com/29237364/57705291-c9e88280-7620-11e9-9c33-78d18c6dadc0.png
[image: outfile2]
<
https://user-images.githubusercontent.com/29237364/57705292-c9e88280-7620-11e9-80fa-75d6c9739cb7.png
Computing environment NCAR Command Language Version 6.5.0 I didn't install it. Linux 2.6.32-754.11.1.el6.x86_64 x86_64
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub
<
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/ADLWOXSHCMOCCZDOYWSTYYLPVLDCHANCNFSM4HM2OEAA
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <
or mute the thread <
https://github.com/notifications/unsubscribe-auth/AG7CA5ADOMX7ZKULYRRNCELPVLJCVANCNFSM4HM2OEAA
.
--
NOAA/ESRL PSD and CU CIRES 303-497-6263 https://www.esrl.noaa.gov/psd/people/cathy.smith/
Emails about data/webpages may get quicker responses from emailing esrl.psd.data@noaa.gov
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub
https://github.com/notifications/unsubscribe-auth/AFBZH7LU3ISCYDOJOLN6EPDPVLK3RANCNFSM4HM2OEAA .
-- Adam Phillips Associate Scientist, Climate and Global Dynamics Laboratory, NCAR www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
http://www.cgd.ucar.edu/staff/asphilli
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NCAR/ncl/issues/97?email_source=notifications&email_token=AG7CA5F3C5OKZX3RLYZ6FKDPVMUADA5CNFSM4HM2OEAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVM2DUY#issuecomment-492413395, or mute the thread https://github.com/notifications/unsubscribe-auth/AG7CA5DIUQD5QHQN5VB5ZXLPVMUADANCNFSM4HM2OEAA.
--
NOAA/ESRL PSD and CU CIRES 303-497-6263 https://www.esrl.noaa.gov/psd/people/cathy.smith/
Emails about data/webpages may get quicker responses from emailing esrl.psd.data@noaa.gov
I am not getting the correct legend when plotting 2 timeseries using gsn_csm_xy2 as I just get one title. If I plot using the same y axis using gsn_csm_xy, I get both titles. I should not get one title. I should ideally get 2. If not I should get 0. Is this fixable?
Provide the following: Code:
key_title1="AAAAA" key_title2="BBBBB" wks = gsn_open_wks("png","outfile") ; open a ncgm file res2 = True res= True res@xyExplicitLegendLabels = (/key_title1,key_title2/) ; explicit labels ndata = new((/2,100/),float)
xinteger = ispan (1,100,1) y1 = fspan(100,199,100) y2 = fspan(150,249,100) ndata(0,:)=y1 ndata(1,:)=y2 res@pmLegendDisplayMode = "Always" ; turn on legend res@pmLegendHeightF = 0.04 ; height of legend.
if(ixy2.eq.1)then plot = gsn_csm_xy2(wks,xinteger,y1,y2,res,res2) else plot = gsn_csm_xy(wks,xinteger,ndata(:,:),res) end if
run:
ncl 'ixy2=1' < test.xy.short.ncl or ncl 'ixy2=0' < test.xy.short.ncl
Computing environment NCAR Command Language Version 6.5.0 I didn't install it. Linux 2.6.32-754.11.1.el6.x86_64 x86_64