使用python向现有直方图添加数据

2024-10-01 13:42:32 发布

您现在位置:Python中文网/ 问答频道 /正文

作为我正在做的一个项目的一部分,我需要在循环中将数据添加到直方图中。项目的一部分要求是我不使用数组来存储数据。下面是我要做的事情的psedo代码:

import matplotlib.pyplot as plt #could by numpy if that works better

plt.hist(define histogram with n bins)

for i in range (bignumber):
     MCMC to find datapoint
     add point to histogram

plt.plot()

我遇到的问题是如何在一个没有数据的柱状图前面加上前缀,然后在生成的时候将数据追加到它上面。在


Tags: to数据项目代码importmatplotlibasplt
1条回答
网友
1楼 · 发布于 2024-10-01 13:42:32

作为一个自我宣传(免责声明!)。。。对于可更新的直方图,您可以使用我的名为physt:https://github.com/janpipek/physt的库。收集完所有数据后,可以使用类似于matplotlib的方式绘制结果(实际上,在后面使用matplotlib)。在

相关问题 更多 >