[ncl-talk] X-Y correlation plot of 2D Arrays
Mary Haley
haley at ucar.edu
Thu Aug 21 10:57:45 MDT 2014
Hi Tabish,
I'm going through some old ncl-talk emails and noticed this one didn't get
responded to.
It helps if you can be more specific about the problem, other than "I
didn't get the desired plot" .
--Mary
On Wed, Aug 13, 2014 at 2:17 PM, Tabish Ansari <tabishumaransari at gmail.com>
wrote:
> Hi
>
> I have 2 matrices of say 100x100 elements. I wish to find the correlation
> between the corresponding elements of each matrix. I understand that there
> will be total 10,000 datapoints to be plotted. (like a(i,j) vs b(i,j))
>
> I am trying to first convert both the 2d arrays to 1d arrays and then use
> the function gsn_csm_xy
>
> However, I am not getting the desired plot. Please help me with this.
>
> Pasted below is the draft script I am trying:
>
> ; ***********************************************
> ; correlation.ncl
> ;
> ; Concepts illustrated:
> ; - Drawing a black-and-white XY plot
> ;
> ;************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;************************************************
> begin
> ;************************************************
> ; read in data
> ;************************************************
> a = addfile ("../wrfout_d01.nc","r")
> b = addfile ("../wrfchemi.nc","r")
>
> x = a->co(0,0,:,:)
> y = b->E_CO(0,0,:,:)
>
> x1 = ndtooned(x)
> y1 = ndtooned(y)
> ;************************************************
> ; plotting parameters
> ;************************************************
> wks = gsn_open_wks ("x11","correlation") ; open
> workstation
>
> res = True ; plot mods desired
> res at tiMainString = "Basic XY plot" ; add title
>
> plot = gsn_csm_xy (wks,x1,y1,res) ; create plot
> end
>
> --
> Thanks & Regards
> Tabish Umar Ansari
> MS Research Scholar
> Environmental & Water Resources Engineering Division
> Department of Civil Engineering
> IIT Madras
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140821/af7d45cd/attachment.html
More information about the ncl-talk
mailing list