Skip to main content

Data Visualisation

Some data visualisation libraries can be used, but require some workarounds.

Matplotlib

By default, matplotlib relies on the import statement from js import document, which does not work from within a web worker.

One workaround is to patch the default behaviour of matplotlib.pyplot.show.

Patching matplotlib.pyplot.show

The following patch sets matplotlib to use the AGG renderer. Source.

caution

This workaround relies on the base64 string to be printed to stdout.

Setting up environment...
Loading...

Result

You can find the source code for this example here.