Sitemap

Member-only story

Real-time and Live charts on Google Colab(Jupyter Notebooks)

2 min readMar 7, 2021

--

Embedding live charts in a website is a trivial task with a websockets or a polling back-end. Having a live chart in a standalone python application is also trivial. However, Jupyter notebooks work differently. They execute python code in notebook servers and brings the results back to the browser.

(https://jupyter.readthedocs.io/en/latest/projects/architecture/content-architecture.html)

One possible solution for achieving this has been mentioned in below stackoverflow thread.

https://stackoverflow.com/questions/21360361/how-to-dynamically-update-a-plot-in-a-loop-in-ipython-notebook-within-one-cell

However, when this code is executed, it has to generate every frame in the server-side and download the image to update the notebook’s output cell. Apart from that, we have to call,

in-order to avoid notebook from drawing each frame as a new image, resulting in thousands of images repeated in the output cell. This could even crash the browser at some point.

The alternative is using Javascript!

--

--

Chathura Widanage
Chathura Widanage

Written by Chathura Widanage

Digital Science Center - Indiana University

No responses yet