Is there any plotting option in Python (IPython-Jupyter notebook) which accepts generators?
AFAIK matplotlib
doesn't support that. The only option I discovered is plot.ly with their Streaming API, but I would prefer not to use online solution due to big amount of data I need to plot in real-time.
A fixed length generator can always be converted to a list.
vals_list = list(vals_generator)
This should be appropriate input for matplotlib
.
Guessing from your updated information, it might be something like this:
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)
Basically using a deque to have a fixed size buffer of data points.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With