matplotlib离散箱图

发布于 2025-02-13 14:00:54 字数 604 浏览 1 评论 0原文

使用离散的bin图,我指的是一种类型的图,该图不会与直线连接点,而是使用最接近每个点的所有区域使用恒定值。

这是使用PDL和PGPLOT的此类图的一个示例。

pdl> use PDL::Graphics::PGPLOT;dev('/xs');$x=rint(grandom(20)*10);print $x;bin($x);hold;points($x,{color=>'red'})

[-19 -3 4 7 -8 -2 9 15 4 7 1 -14 -4 -4 11 6 -15 -13 2 1]Graphics on HOLD

这种类型的图有时很有用。

我有兴趣了解一种在matplotlib中显示这种类型情节的方法。我找不到特定功能。

在Matplotlib中进行此操作的替代方法也将很有用,也许是其他用于绘制Python的软件包。非常感谢!

With discrete bin plot I refer to a type of plot which does not connect the points with a straight line, but uses a constant value for all the region which is closest to each point.

This is an example of this type of plot using PDL and PGPLOT.

pdl> use PDL::Graphics::PGPLOT;dev('/xs');$x=rint(grandom(20)*10);print $x;bin($x);hold;points($x,{color=>'red'})

[-19 -3 4 7 -8 -2 9 15 4 7 1 -14 -4 -4 11 6 -15 -13 2 1]Graphics on HOLD

enter image description here

This type of plot is sometimes useful.

I am interested in knowing a way to display this type of plot in matplotlib. I could not find a specific function.

Alternative ways to do it in matplotlib would also be useful as well as perhaps other packages for plotting in python. Thank you very much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

π浅易 2025-02-20 14:00:54

这就是称为a step plot matplotlib in matplotlib:

import matplotlib.pyplot as plt

y = [-19, -3, 4, 7, -8, -2, 9, 15, 4, 7, 1, -14, -4, -4, 11, 6, -15, -13, 2, 1]
plt.step(range(len(y)), y, 'o-', where='mid')

“

This is called a step plot in matplotlib:

import matplotlib.pyplot as plt

y = [-19, -3, 4, 7, -8, -2, 9, 15, 4, 7, 1, -14, -4, -4, 11, 6, -15, -13, 2, 1]
plt.step(range(len(y)), y, 'o-', where='mid')

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文