# Python API: visualizations

**URL:** https://forum.qiime2.org/t/python-api-visualizations/3097
**Category:** User Support
**Tags:** artifact-api
**Created:** [February 19, 2018, 4:46pm UTC](https://forum.qiime2.org/t/python-api-visualizations/3097 "2018-02-19T16:46:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tomasz](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/dbc845/32.png) [@tomasz](https://forum.qiime2.org/u/tomasz)
#### Post date: [February 19, 2018, 4:46pm UTC](https://forum.qiime2.org/t/python-api-visualizations/3097/1 "2018-02-19T16:46:56Z")

</div>

Hello!

how can I visualize visualization objects in Jupyter? For example, I run  
`feature_table.visualizers.tabulate_seqs(deblur_sequences.representative_sequences)`  
and all I get is this:

```auto
Results (name = value)
-----------------------------------------------------------------------------------------
visualization = <visualization: Visualization uuid:
9486c314-d14a-4e30-b52c-ca97a68af501>

```

How can I get the visualization I would normally get from using `qiime tools view artifact.qzv`? Do I have to save it first and then visualize from a saved qzv file?

thanks,  
Tomasz

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [February 19, 2018, 6:16pm UTC](https://forum.qiime2.org/t/python-api-visualizations/3097/3 "2018-02-19T18:16:36Z")

</div>

Hi @tomaz, we don't have a good workflow developed yet for viewing visualizations within Jupyter - check out this post for a little detail:

> [@Embedding visualizations in jupyter](https://forum.qiime2.org/t/embedding-visualizations-in-jupyter/404/2):
>
> 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).

Maybe @uria can provide some more details about their workaround.

Otherwise, we are stuck working within Jupyter's limitations, so some code like this can get you moving:

```python
viz = feature_table.visualizers.tabulate_seqs(rep_seqs)
viz.visualization.save('foo.qzv')
!qiime tools view foo.qzv

```

This will open the visualization in a new tab, although YMMV depending on how Jupyter NB is configured.

---

<div class="post-metadata">

### Author: ![uria](https://forum.qiime2.org/user_avatar/forum.qiime2.org/uria/32/4822_2.png) [@uria](https://forum.qiime2.org/u/uria)
#### Post date: [February 19, 2018, 7:04pm UTC](https://forum.qiime2.org/t/python-api-visualizations/3097/5 "2018-02-19T19:04:57Z")

</div>

Hey there @tomasz ,

regarding

> [@thermokarst](#):
>
> Maybe @uria can provide some more details about their workaround.

Though I really couldn't find a good reason to use this workaround (qiime view works just fine for me...) what I suggested in [mentioned thread](https://forum.qiime2.org/t/embedding-visualizations-in-jupyter/404/2) is to:

1. Extract the visualization object as a directory

```python
out_dir = "/tmp/deblur_sqs_vis"
feature_table.visualizers.tabulate_seqs(deblur_sequences\
                .representative_sequences).export_data(out_dir)

```

Now you should have (I hope) a directory called deblur\_sqs\_vis under /tmp. This directory also should contain sub-directory named data in which there's an index.html file.  
2. Use the HTML object in IPython.core.display in order to view this directory

```python
from IPython.core.display import HTML
HTML('<iframe height = 1000, width = 1000, src = "{}/data/index.html"> </iframe>'\
    .format(out_dir))

```

Hope it'll work for you.

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [March 23, 2018, 1:05am UTC](https://forum.qiime2.org/t/python-api-visualizations/3097/6 "2018-03-23T01:05:10Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
