如何使用python绘制3d条形图/直方图+颜色?

时间:2019-09-09 14:20:59

标签: python matplotlib mplot3d

我想用python(或散布..)绘制3d条形图或直方图,并根据矩阵重新显示每个条形的颜色。

每个条的高度在矩阵“ z”中。 每个单条的颜色应根据数字矩阵“颜色”而变化(因为我有4d数据)

在示例中我没有发现任何类型的数据

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np

x_axis = ["Piccola",
          "Media",
          "Grande"]

y_axis = [1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1]

z = [ [0.03,0.18,0.24,0.12,0.9,0.21,0.06,0.24,-0.06,-0.24],
      [0,0.03,0.03,-0.06,0.03,0,-0.03,-0.03,-0.09,-0.09],
      [0,0,-0.03,-0.03,-0.06,-0.06,-0.03,-0.06,-0.09,-0.29] ] 

colors =[ [24.67,27.50,30.25,25.6,31.87,42.67,31.39,49.58,50.27,53.76],
          [17.17,21.67,21.96,22.11,19.45,17.44,17.95,22.51,28.21,46.14],
          [17.18,18.01,17.68,15.03,17.80,17.93,14.75,18.88,24.7,39.75] ]

0 个答案:

没有答案