Plot multiple live graph's using data from an updating dictionary

40 views Asked by At

I have a dict (DATADict) full of data that gets updated constantly, I want to be able to use the data from the dict and have it plot onto a plotly/matplotlib plot. The x will be the time, which is the same for every y value in every subplot. I have tried with matplot and plotly, with matplot I had some success but I couldn't get the axis right and all the points updated at different times (I was using matplot animation), plotly I couldn't even get the same graph to update ot kept opening browsers.

Something that looks like this but with the y axis labled with the name of the key. Ideal Plot

This is the code for getting the updating Dictionary.

While True:
    Data = {"Temp":10,"Pressure":10} #This is an example of what the dict looks like but its called from another module (There is about 7 keys in total)
    for k,v in Data.items():
        if k not in DATADict.keys():
            fig = plt.fig()
            DATADict.update({k:{"List":[],"Fig":fig}})
        DATADict[k]["List"].append(v)
    #print(DATADict)

Anyone got any ideas how I would get the live data from a dict to be displayed on a plot that all has the same Y value's being time?

0

There are 0 answers