Embedding visualizations in jupyter

Is it possible to embed a visualization into jupyter?

I know you can drag/drop visualizations into https://view.qiime2.org/ and provide urls.
Is there an existing interface that allows for the index.html page to be embedded directly into a jupyter notebook?

1 Like

Not yet, but that would be really nice. The technical limitation right now is figuring out a way out of the jupyter sandbox as index.html files in visualization usually load assets and other files, so we need a way to “hoist” that directory into something that the jupyter notebook would serve (or we start an ephemeral web-server for reprs).

2 Likes

You can start by playing with the HTML object in the IPython.display module:

from IPython.core.display import display, HTML, display_html
HTML(''.format(index_html_path))

where index_html_path is the path to the relevant visualization index.html.

It works perfectly for me, though the extraction of visualization directory with CLI cause me some headache.

I'll try to get VFS abstraction I wrote a while ago to function as a wrapper for the qzv files - if it works, we can basically trick the HTML object to treat the (wrapped) qzv as simple file directory.

Any other ideas?
Uria

2 Likes