Skip to main content

Static Interactive Figures for Jupyter Notebooks

Generate interactive figures in Jupyter which solely depend on JavaScript and can be exported to static HTML webpages. Forked from https://github.com/jakevdp/ipywidgets-static

See HTML example here

Install:

pip install staticinteract

I really liked the functionality provided by the, now abandoned, project ipywidgets-static. Contrary to what it is stated in the original repo, iPython's ipywidgets do not provide the same functionality of ipywidgets-static (as far as I know, that is). Specifically, iPython's ipywigets depend on an active Jupyter kernel to work. Thus, interactive figures do not work in situations where there isn't any kernel to support them, such as when displaying the notebook as a webpage after converting it to HTML.

I find it very useful to be able to maintain interactivity of figures in HTML-displayed notebooks. For instance, to share scientific results with colleagues. For this reason I have added some new features to the original project and made it into this package so it's easier to install.

These are the main additions:

  1. First, I updated the code to be compatible with python 3 since I do not use python 2, and it's doomed to disappear anyways.
  2. I added the possibility to store the generated images in a folder instead of embedding them in the notebook. Embedding the images within the notebook makes sense for small interactive plots, i.e., ones which do not generate many images. However, in larger ones the notebook gets soon saturated with embedded images, it's slow to load or simply won't load properly. To solve this issue, images can now be stored outside the notebook, as png files, and are imported to the notebook when called by the interactive plot.
  3. In the previous version, StaticInteract would write the same JavaScript code to the notebook cell where it was called. I find this repetitive and unnecessary, moreover prone to errors due to declaring more than once the same JavaScript variables when multiple interactive plots are done in a single notebook. To solve this issue, this part of JavaScript code is now embedded in the notebook only at the beginning, when the module is imported.

NOTE: The notebook needs to be trusted for interactive figures to work, since untrusted notebooks do not run embedded JavaScript code. Once the Notebook is exported to HTML, interactive figures will continue to work.

Release files for staticinteract 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for staticinteract 0.0.3
File Size Uploaded
staticinteract-0.0.3.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for staticinteract 0.0.3
File Interpreter ABI Platform
staticinteract-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / staticinteract-0.0.3.tar.gz

Download URL staticinteract-0.0.3.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1133ddd7cfebf0100056502840bf117bbef3ba44ea2253e3272f8fd837b42bd2
BLAKE2b-256 checksum
How to use checksums
af69c142ca9b8d2a2ca2a118717100831cd2bae368a2a453774071bf28ddb7c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.6.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

Release files / staticinteract-0.0.3-py3-none-any.whl

Download URL staticinteract-0.0.3-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
766354601fa7a5b2287af66620ceb6ad8a0e3032710ca1dcf52273ebb4beb91a
BLAKE2b-256 checksum
How to use checksums
aaa9ae13b841e06f2890fe1bc03b59c7e39e2689799e24de09ea8c831266c8db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.6.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page