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.

Loading...

Result

No image yet. Click run to see the result.

You can find the source code for this example here.

Folium

caution

This workaround relies on the HTML output to be printed to stdout.

Loading...

Result

No output yet. Click run to see the result.

You can find the source code for this example here.

Plotly

caution

This workaround relies on the HTML output to be printed to stdout.

Loading...

Result

No output yet. Click run to see the result.

You can find the source code for this example here.