2024-05-14 10:01:04 发布
网友
Python(IPython Jupyter notebook)中是否有接受生成器的绘图选项?
AFAIKmatplotlib不支持这个。我发现的唯一选择是plot.ly使用他们的流式API,但由于需要实时绘制大量数据,我不希望使用在线解决方案。
matplotlib
固定长度生成器始终可以转换为列表。
vals_list = list(vals_generator)
这应该是matplotlib的适当输入。
根据您的最新信息推测,可能是这样的:
from collections import deque from matplotlib import pyplot data_buffer = deque(maxlen=100) for raw_data in data_stream: data_buffer.append(arbitrary_convert_func(raw_data)) pyplot.plot(data_buffer)
基本上使用deque来拥有固定大小的数据点缓冲区。
固定长度生成器始终可以转换为列表。
这应该是
matplotlib
的适当输入。根据您的最新信息推测,可能是这样的:
基本上使用deque来拥有固定大小的数据点缓冲区。
相关问题 更多 >
编程相关推荐