我正在尝试hist2d
从 x,y 坐标列表中绘制 a ,但得到 a Value Error: too many values to unpack (expected 2)
。
代码是:
visuals = [[],[],[]]
with open('Wide_Single_timestamp2.csv') as csvfile :
readCSV = csv.reader(csvfile, delimiter=',')
n=0
for row in readCSV :
if n == 0 :
n+=1
continue
visuals[0].append(list(map(float, row[2::2])))
visuals[1].append(list(map(float, row[3::2])))
X = visuals[1]
Y = visuals[0]
fig, ax = plt.subplots(figsize = (8,7))
plt.grid(False)
data,x,y,p = plt.hist2d(X,Y, bins = 10, range = np.array([(-90, 90), (4, 140)]))
plt.imshow(data, interpolation = 'gaussian', origin = 'lower', extent = [-90,90,4,140], cmap = 'jet')
当我将列表减少为单行时,该代码有效:
Y = visuals[1][0]
X = visuals[0][0]
但我需要绘制更多的数据点。