您可以使用轴上的极坐标投影来完成此操作.请注意,根据您提供的示例,这不适用于imshow. (见:
http://en.it-usenet.org/thread/15998/715/)
但是,您仍然可以进行插值,然后绘制热图.以下是一个简单的例子:
from pylab import *
import numpy as np
from scipy.interpolate import griddata
#create 5000 Random points distributed within the circle radius 100
max_r = 100
max_theta = 2.0 * np.pi
number_points = 5000
points = np.random.rand(number_points,2)*[max_r,max_theta]
#Some function to generate values for these points,
#this could be values = np.random.rand(number_points)
values = points[:,0] * np.sin(points[:,1])* np.cos(points[:,1])
#now we create a grid of values, interpolated from our random sample above
theta = np.linspace(0.0, max_theta, 100)
r = np.linspace(0, max_r, 200)
grid_r, grid_theta = np.meshgrid(r, theta)
data &