我正在关注此帖Parameters required by bar3d with python以了解bar3d的参数。该图表与数据吻合,但绘图不准确。我期待0,0正好在0,0。此外,dx = 0.1和dy = 0.1应该显示方形印象,但不是。
以下是数据
- { x: -3.6, y: -0.019, occurence: 676 }
- { x: -3.10, y: -0.0999, occurence: 676 }
- { x: -1.9, y: -0.0999, occurence: 676 }
- { x: -0.07, y: 0., occurence: 676 }
- { x: 0., y: 0., occurence: 25564 }
- { x: 5.941, y: 0.0199, occurence: 24644 }
- { x: 5.942, y: 0.0199, occurence: 49288 }
- { x: 5.96, y: 0.0199, occurence: 24723 }
相应的代码是
dx = np.empty(np.size(x))
dx.fill(0.1)
dy = np.empty(np.size(x)
dy.fill(0.1)
z = np.zeros(np.size(x_gt))
ax1.bar3d(x, y, z, dx, dy, occurence, "red" ) # z is dummy. occurence is height