plotting irregular spaced data

Caught by the default Reply-to...

···

---------- Forwarded message ----------
From: Scott Sinclair <scott.sinclair.za@...287...>
Date: 8 July 2010 13:46
Subject: Re: [Matplotlib-users] plotting irregular spaced data
To: Ross Williamson <rosswilliamson.spt@...287...>

On 8 July 2010 00:15, Ross Williamson <rosswilliamson.spt@...287...> wrote:
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?

If your z are actually values at points in (phi, theta), you might
find it easier to use scatter().

import matplotlib.pyplot as plt
plt.scatter(phi.ravel(), theta.ravel(), c=z.ravel(), edgecolors='none')
plt.colorbar()

Cheers,
Scott