Skip to main content

Jupyter static interactive figures

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

staticinteract-0.0.3.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

staticinteract-0.0.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file staticinteract-0.0.3.tar.gz.

File metadata

  • Download URL: staticinteract-0.0.3.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for staticinteract-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1133ddd7cfebf0100056502840bf117bbef3ba44ea2253e3272f8fd837b42bd2
MD5 62ebc6bc1fc2050380b49dc8588f87eb
BLAKE2b-256 af69c142ca9b8d2a2ca2a118717100831cd2bae368a2a453774071bf28ddb7c4

See more details on using hashes here.

File details

Details for the file staticinteract-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: staticinteract-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for staticinteract-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 766354601fa7a5b2287af66620ceb6ad8a0e3032710ca1dcf52273ebb4beb91a
MD5 5d751d67da51f8c1496bd772d220b1af
BLAKE2b-256 aaa9ae13b841e06f2890fe1bc03b59c7e39e2689799e24de09ea8c831266c8db

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page