我必须冲刺,但这就是我尝试绘制数据的方式 - count
vs(i,j)
示例 - 请参阅最后一行左右的索引切片。如果您需要,很高兴进一步了解。
>>> from mpl_toolkits.mplot3d import Axes3D
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import random
>>>
>>> count = []
>>> for i in range(1, 4):
... for j in range(3, 6):
... for k in range(15,19):
... count.append((i, j, k, random.random()))
...
...
...
...
>>> data = np.array(count)
>>> fig = plt.figure()
>>> ax = fig.gca(projection='3d')
>>>
>>> # I think this is the sort of thing you want:
>>>
>>> ax.plot_trisurf(data[:,0], data[:,1], data[:,3])
/usr/local/lib/python2.7/dist-packages/matplotlib/delaunay/triangulate.py:103: DuplicatePointWarni
ng: Input data contains duplicate x,y points; some values are ignored.
DuplicatePointWarning,
<mpl_toolkits.mplot3d.art3d.Poly3DCollection object at 0x46e8390>
>>> plt.show()