Matplotlib'in kontur fonksiyonu ile ilgili bir problemim var. Verilerimi içe aktardığım bir txt veri dosyası var. Veri sütunlarım var (pm1 ve pm2) ve bir 2D histogramı yapıyorum. Bu verileri bir 3D histogram olarak çizmek ve maksimum değerlerin nerede bulunduğunu görmek için bir kontur çizimi yapmak istiyorum.3D histogramlar ve Kontur çizimleri Python
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
rows = np.arange(200,1300,10)
hist, xedges, yedges = np.histogram2d (pm1_n, pm2_n, bins = (rows, rows))
elements = (len(xedges) - 1) * (len(yedges) - 1)
xpos, ypos = np.meshgrid(xedges[:-1], yedges[:-1])
xpos = xpos.flatten()
ypos = ypos.flatten()
zpos = np.zeros(elements)
dx = 0.1 * np.ones_like(zpos)
dy = dx.copy()
dz = hist.flatten()
#####The problem is here#####
#ax.contourf(xpos,ypos,hist)
#ax.bar3d(xpos, ypos, zpos, dx, dy, dz, zsort='average')
plt.show()
ben 3d çubuk grafik çizmek olabilir ama ben hata alıyorum contourf fonksiyonunda hist
yerleştirirseniz, kontur bir arsa mümkün değilim: Length of x must be number of columns in z
ve eğer
Bu
benim kodudur Bendz
yerleştiriyorum
Input z must be a 2D array
Ben de xedges ve yexges kullanmayı denedim ama bu sorunu çözmez.
Problemin histogram2D işlevinin geri dönüş şekli ile ilgili olduğunu düşünüyorum. Ama nasıl çözeceğimi bilmiyorum.
Ayrıca, en az değere kadar değişen bir renk kodu ile bir 3D çubuk arsa gerçekleştirmek istiyorum. Bunu yapmak için zaten var mı?
Eğer
Colorbar özelleştirme satırlarına yapılan başvurular: [pylab example] (http://matplotlib.org/examples/pylab_examples/hist_colormapped.html) ve [bu gönderi] (http://stackoverflow.com/questions/11950375/apply -renk-haritası-to-mpl-araci-mplot3d-axes3d-bar3d) – lanery