3D-Stacked 2D histograms in matplotlib pyplot

后端 未结 2 576
野性不改
野性不改 2020-12-18 06:28

I have a bunch of 2D histograms (square 2D numpy arrays) that I want to stack in 3D like so:

\"Image

2条回答
  •  醉梦人生
    2020-12-18 06:38

    To supplement @Bence's answer, the additional vertical colorbar can be added using a snippet of code from here. Specifically, I used the following code, where 'xxx' is my data set, where each layer shown in Bence's plot is a separate z layer in a dstack'd numpy array. :

    m = cm.ScalarMappable(cmap=cm.jet)
    m.set_array(xxx)
    pyplot.colorbar(m)
    pyplot.show()
    

提交回复
热议问题