I have been trying to get an updated plot from a pandas dataframe without success. My problem: the plot window does not appear (it is not hidden - I am sure about that).
I already tried to rebuild and change different solutions from stackoverflow. My most recent try is based on this post. Pure copy,paste does work, so the problem needs to be in my modifications.
I changed it to this as I want to update it automatically every second.
import serial as s
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from time import sleep
data = pd.DataFrame(np.random.random((10,10))) # I want to use pandas because
# of easier timestamp handling
fig, ax = plt.subplots()
ax.set(title='title')
im = ax.imshow(data)
while True:
im.set_data(np.random.random((10,10)))
print "hello" #just to see if sth happens
fig.canvas.draw()
sleep(1)
plt.show()
Just to explain: Later I want to read data from serial ports and feed them to the plot to get my data visualized.
Well, what you expect: the provided code does print hello each second but does not show me any plot. Any ideas? I am out of them.
By the way: I am surprised that there is no "easy, straight forward" solution for this kind of problem to be found. I can imagine, there is some people who are trying to do updated plots?!