使用Python的bar3d所需的参数 [英] Parameters required by bar3d with python

查看:21
本文介绍了使用Python的bar3d所需的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 python 制作一个 3d 条形图,我发现了 bar3d 函数.这是文档.我不明白必须将哪些值传递给 bar3d ,文档仅告诉我有关适当格式的信息.我在互联网上以及在stackoverflow上都找到了一些示例,但是这些并没有帮助我确定哪个参数包含哪些信息.

I want to make a 3d bar plot with python, and I discovered the bar3d function. Here is the documentation. I do not understand which values I have to pass over to bar3d, documentation only tells me something about the appropriate format. I have found a few example on the internet, and also on stackoverflow, but these didn't help me to figure out which parameter contains which information.

基本上,这是我的功能:

Basically, this is my function:

bar3d(x, y, z, dx, dy, dz, color='b', zsort='average', *args, **kwargs)

我不明白 x,y,z dx,dy,dz 代表什么.有人可以帮助我吗?

I do not understand what x, y, z and dx, dy, dz do represent. Can anyone pls help me?

推荐答案

x, y, z, dx dy dz 是迭代器.它们代表每个条的 x y z 位置以及 dx dy dz 分别表示宽度、深度和高度(xyz 中的尺寸)酒吧.注意x为横轴,y为深度轴,z为纵轴.

x, y, z, dx, dy, dz are iterators. They represent the x and y, z positions of each bar and dx, dy, dz represent the width, depth, and height (dimensions in x, y and z) of the bars. Note that x is the horizontal axis, y is the depth axis, and z is the vertical axis.

因此可以绘制高度为 5、4 和 7 的连续 3 个条形:

So 3 bars in a row with height of 5, 4 and 7 could be drawn like:

x = [1, 2, 3]  # x coordinates of each bar
y = [0, 0, 0]  # y coordinates of each bar
z = [0, 0, 0]  # z coordinates of each bar
dx = [0.5, 0.5, 0.5]  # Width of each bar
dy = [0.5, 0.5, 0.5]  # Depth of each bar
dz = [5, 4, 7]        # Height of each bar

所有这些都具有相同的宽度和深度.

All of them would have the same width and depth.

color 可以采用描述所有条形颜色的字符串,也可以采用字符串列表,如果您希望每个条形具有不同的颜色.

color takes either a string that describes the color of all the bar, or a list of strings, if you want each bar with a different color.

我认为 zsort 与matplotlib处理重叠的方式有关,但这只是一个猜测.

I think zsort has to do with how matplotlib is handling overlaps, but that is just a guess.

这篇关于使用Python的bar3d所需的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆