使用自定义频率值创建直方图

发布于 2025-02-03 19:18:39 字数 523 浏览 1 评论 0原文

我想创建一个具有已知频率值的直方图图。直方图就像 - 直方图图。我可以使用Web Plot Digitiser找到所需的“数量密度”/Y轴值,现在想用每个特定垃圾箱的数量密度的正确Y轴值重新创建该图。我已经查找了Matplotlib和其他相关问题的教程,但似乎无法完成。假设在Python甚至其他语言中是否可以使用它,那么对此的任何帮助/资源都会有所帮助。

编辑 - 我期望的输出应该有点像这样(我知道它很粗糙) - 输出

我要绘制为直方图的数据可以假定为

-4.2 nm至4.3 nm -0%(此范围内无值)

4.3 nm至4.4 nm -33%

4.4 nm至4.5 nm -40%

I want to create a histogram plot with already known values of the frequency. The histogram is like - histogram plot. I can find the required 'number density'/y-axis values using web plot digitiser and now want to recreate this plot with the correct y-axis values of the number density of each particular bin. I have looked up tutorials of matplotlib and other related questions but it does not seem like it can be done with it. Any help/resource regarding this would be helpful, assuming if it is possible in python or even another language.

Edit - The output I am expecting should be somewhat like this (I know its quite crude) - output

The data I want to plot as a histogram could be assumed to be like -

4.2 nm to 4.3 nm - 0%(no values in this range)

4.3 nm to 4.4 nm - 33%

4.4 nm to 4.5 nm - 40%

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

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

发布评论

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

评论(1

娇纵 2025-02-10 19:18:39

假设您已经有一个列表,每个垃圾箱和垃圾箱中心都有百分比

import matplotlib.pyplot as plt
binCenters = [4.2, 4.3, 4.4]
percentages = [0, 33, 40]
plt.bar(binCenters, percentages)
plt.show()

Supposing you already have a list with the percentages in each bin and the bin centers

import matplotlib.pyplot as plt
binCenters = [4.2, 4.3, 4.4]
percentages = [0, 33, 40]
plt.bar(binCenters, percentages)
plt.show()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文