Python&Pandas:从datafram的2列创建一个3d柱状图

2024-05-20 18:22:25 发布

您现在位置:Python中文网/ 问答频道 /正文

在我的数据框中,我有df['incre']df['incre_reverse'],数据如下(最后2列): enter image description here

现在,我要绘制一个3d柱状图(或带颜色的2d),其中X, Ydf['incre']df['incre_reverse']Z是发生的次数。在

我怎么能做到呢?在

我在这里找到一个例子:http://matplotlib.org/examples/mplot3d/hist3d_demo.html

但我能做的就是:

enter image description here

对于散点图:

X = df['incre']
Y = df['incre_reverse']
plt.scatter(X, Y, alpha = 0.3)

enter image description here

有什么建议可以让散点图更清楚些吗?或者什么是绘制3d直方图的好方法?在


Tags: 数据orghttpdfmatplotlib颜色绘制次数