3D гистограмма увеличивает площадь панели

#python #matplotlib #3d

#python #matplotlib #3D

Вопрос:

У меня есть следующий код, взятый из дистрибутива, а затем строит 3D-гистограмму, соответствующую частоте в ячейке.

 # Given a data array of x and y such that they correspond
# to a number of points, this draws a 3d Bar Graph corresponding
# to density of points.
def hist_3dBar(x,y,bins):
    fig = plt.figure()
    ax = Axes3D(fig)
    hist, xedges, yedges = np.histogram2d(x,y,bins)
    elements = (len(xedges) - 1) * (len(yedges) - 1)
    xpos, ypos = np.meshgrid(xedges[:-1] 0.25, yedges[:-1] 0.25)
    xpos = xpos.flatten()
    ypos = ypos.flatten()
    zpos = np.zeros(elements)
    dx = np.ones_like(zpos)
    dy = dx.copy()
    dz = hist.flatten()
    ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b', zsort='average')
    return fig
 

С помощью кода, который его вызывает:

 # Produce a number of points in x-y from another distribution.
mean = [0,0]
cov = [[3,2],[2,3]] 
xp,yp = np.random.multivariate_normal(mean,cov,1000).T
plt.plot(xp,yp,'o'); plt.axis('equal'); plt.show()
hist_3d = gauss.hist_3dBar(x,y,10)
 

Я просто хочу, чтобы столбцы располагались рядом друг с другом, без пробелов внизу. Кроме того, как я могу получить его цветовой код в соответствии с частотой в ячейке?

Спасибо!