Re: a question regarding scatter plot

From: H.Dang <danghy_at_nyahnyahspammersnyahnyah>
Date: Fri Apr 01 2011 - 10:26:09 MDT

Hi Mary,

Thanks for your kind explanation. So my current understanding is that
"gsn_csm_xy (wks,ts&time,data,res)" is to plot 2 sets of data. :

1. ts vs. data(0,:)
2. ts vs. data(1,:)

Based on http://www.ncl.ucar.edu/Applications/Scripts/scatter_4.ncl,

 x = ispan(0,dimsizes(ts)-1,1)*1.
...
 data(0,:) = ts
 data(1,:) = rc*(x-rc@xave) + rc@yave
...
 res@xyMarkLineModes = (/"Markers","Lines"/) ; choose which have
markers
...
 plot = gsn_csm_xy (wks,ts&time,data,res) ; create plot
end

It firtly plots "ts vs data(0,:)=ts", which should be a line with slope 1.
Then it will plot "ts vs data(1,:)=regression line". In both cases, ts is
the x-axes, but this code corresponds to the figure
http://www.ncl.ucar.edu/Applications/Images/scatter_4_lg.png

Since this figure's x-axes is "time", I don't understand why the code is not
like:

plot = gsn_csm_xy (wks,x,data,res)

Cheers
Hongyan
On Fri, Apr 1, 2011 at 10:13 AM, Mary Haley <haley@ucar.edu> wrote:

> On Mar 31, 2011, at 5:06 PM, H.Dang wrote:
>
> Hi dear all,
>
> I have a question regarding a scatter plot example on NCL website:
>
> http://www.ncl.ucar.edu/Applications/Scripts/scatter_4.ncl
>
> The last 2 lines are:
>
> plot = gsn_csm_xy (wks,ts*&time*,data,res) ; create plot
> end
>
> The "&time" doesn't work in my NCL, but I can get plots simply use:
>
> plot = gsn_csm_xy (wks,ts**,data,res) ; create plot
> end
>
> I'm not sure if it's okay if I do it this way.
>
>
> Dear Hongyan,
>
> It's okay to put "ts" there, as long as the dimensions of ts and data are
> correct, and that this is what you actually want to plot.
> This call will simply put the "ts" values on your X axis and the "data"
> values on your Y axis.
>
>
> And is the x-axes is the pre-defined "x"?
>
>
> x = ispan(0,dimsizes(ts)-1,1)*1.
>
>
>
> No, it should be set to the values of "ts". That is, the X values will
> span min(ts) to max(ts).
>
> If you had used:
>
> plot = gsn_csm_y(wks,data,res) ; Note, no "ts"
>
> Then "data" would be on your Y axis, and the x axis would be the "ispan"
> values as you defined above.
>
> --Mary
>
>
> Thank you.
> --
> Cordially,
> Hongyan(ΊθΡγ)
> Tel: 1-519-8884567ext36667
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>

-- 
Cordially,
Hongyan(ΊθΡγ)
Tel: 1-519-8884567ext36667

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 1 10:26:41 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 05 2011 - 09:01:21 MDT