[英]How to fill mplot3d bar plot depth? [Python 3.x]
There is an example for how to build a bar plot at the bottom of this question taken from the matplotlib site. 在matplotlib站点的此问题的底部,有一个示例如何构建条形图。
I cannot find a parameter to increase the depth of each bar. 我找不到增加每个栏的深度的参数。 I want depth to give it a 3d look like this picture.
我想要深度给它一个3d的外观,如这张照片。
Is there a function parameter to change this that I'm not seeing, or will I need to use a different 3D bar plot function? 是否有一个功能参数可以更改我没有看到的功能,还是需要使用其他3D条形图功能?
Below is the bar plot code from the first link in case someone can't see it: 下面是第一个链接的条形图代码,以防有人看不到它:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]):
xs = np.arange(20)
ys = np.random.rand(20)
# You can provide either a single color or an array. To demonstrate this,
# the first bar of each set will be colored cyan.
cs = [c] * len(xs)
cs[0] = 'c'
ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.show()
I've found this link to a solution but this solution doesn't actually increase the depth. 我已经找到此解决方案的链接,但此解决方案实际上并没有增加深度。 I'm hoping for a method to completely fill the depth if possible.
我希望有一种方法可以完全填充深度。
Do you want something like the code in this answer ? 您是否想要类似此答案中的代码的内容? They use bar3d() , but the locations for each bar are manually created with meshgrid.
他们使用bar3d() ,但是每个网格的位置都是使用meshgrid手动创建的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.