简体   繁体   中英

How to create a real-time plot with mpld3

Is there a way to add a new data point and remove an old one (push, shift principle) with mpld3 on the frontend side? I would like to make a real-time plot using mpld3. Initializing the plot once and updating it with websockets for example... The only way I could think of so far is updating the data directly in javascript after initialization using the underlying d3 library like in this example .

It's easiest to do this using D3.JS on the client side.

If you really hate writing JS code and are OK with having to refresh the page to update, you can do this by providing the image via a hook on your backend which rewrites and sends a fresh matplotlib figure every time a request is made. This is a Bad Idea though, for a variety of reasons.

I'm not aware of any capacity in which mpld3 in and of itself is helpful here, sorry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM