 # plotting irregular spaced data

Hi Everyone

I think I'm being dumb but I have a set of 2d data (2d array) z
(100x100) which I need to plot - I have a nominal set of x and y
positions say:

x = linspace(0,100)
y = linspace(0,100)

Now the actual positions of the points in z are given by the following:

u,v = meshgrid(x,y)

phi = arctan2(v,u)
theta = arcsin(u/cos(phi))

so I have three 2d arrays (100x100) which describe the postion
(phi,theta) of the points in z

How do I go about plotting these say using imshow?

Cheers

Ross

···

--
Ross Williamson
University of Chicago
Department of Astronomy & Astrophysics
773-834-9785 (office)
312-504-3051 (Cell)

imshow requires the data to be regularly spaced. use pcolor instead.

Also, to be clear, pcolor() can take 1-D X and Y arguments, but only if it is regular. If the coordinates are irregular, then you need to use 2D X and Y arguments.

Ben Root

···

On Wed, Jul 7, 2010 at 5:15 PM, Ross Williamson <rosswilliamson.spt@…287…> wrote:

Hi Everyone

I think I’m being dumb but I have a set of 2d data (2d array) z

(100x100) which I need to plot - I have a nominal set of x and y

positions say:

x = linspace(0,100)

y = linspace(0,100)

Now the actual positions of the points in z are given by the following:

u,v = meshgrid(x,y)

phi = arctan2(v,u)

theta = arcsin(u/cos(phi))

so I have three 2d arrays (100x100) which describe the postion

(phi,theta) of the points in z

How do I go about plotting these say using imshow?

Cheers

Ross

Ross Williamson

University of Chicago

Department of Astronomy & Astrophysics

773-834-9785 (office)

312-504-3051 (Cell)

This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users