Re: Add polyline in gsn_csm_xy2.

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun, 30 Mar 2008 07:32:42 -0600

Hi Yi Wang,

You are correct that the plot id returned is the one associated with
the left Y axis.
To draw something in the space of the data of the right Y axis, you can
use the
special "xy2" attribute that is returned as an attribute of the plot id.

For example, if xpm and ypm were the data space of the right Y axis,
then
you would use:

dummy0(mm) = gsn_add_polyline(wks,plot_at_xy2,xpm,ypm,gsres)

Of course, the problem comes in that you have an array of plots, so
every time
you create a new plot, the "xy2" attribute will get overwritten. You
could save
this to a local variable if you needed it to stay "alive" for the
duration of the script:

xy2 = new(nplots,graphic)

plot(mm) = gsn_csm_xy2(wks,idate,clm_plot(0,:),clm_plot1(0,:),res1,res2)
xy2(mm) = plot_at_xy2
dummy0(mm) = gsn_add_polyline(wks,xy2(mm),xpm,ypm,gsres)

--Mary

On Mar 28, 2008, at 1:47 PM, Wang, Yi wrote:

> Hi Folks:
>
> I wonder how to specify which Y-axis to use when adding polyline in
> gsn_csm_xy2 function. See below:
>
> res1_at_tiYAxisString = "NOV-APR Climatology"
>
> plot(mm) =
> gsn_csm_xy2(wks,idate,clm_plot(0,:),clm_plot1(0,:),res1,res2)
>
> gsres1 = True ; poly res
> gsres1_at_gsFillColor = "blue" ; color chosen
> dummy1(mm) = gsn_add_polygon (wks,plot(mm),xp9,yp9,gsres1)
>
> gsres = True ; now draw
> significance lines
> xpm = new( (/2/), float )
> ypm = new( (/2/), float )
> xpm = (/1.,96./)
> daym = clm_mean
> ypm = (/daym,daym/)
> gsres_at_gsLineColor = "brown"
> gsres_at_gsLineThicknessF = 3.
>
> dummy0(mm) = gsn_add_polyline(wks,plot(mm),xpm,ypm,gsres)
>
> My dummy0 seems to follow the left Y-axis, rather than the right
> Y-axis,
> which I prefer.
>
> Thanks in advance,
>
> Yi Wang, PhD
> Pacific Northwest National Lab
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Mar 30 2008 - 07:32:42 MDT

This archive was generated by hypermail 2.2.0 : Mon Mar 31 2008 - 09:11:46 MDT