[yt-users] using show() in ipython/python

Nathan Goldbaum nathan12343 at gmail.com
Tue Dec 2 14:45:24 PST 2014


On Tue, Dec 2, 2014 at 1:45 PM, Johanna Malinen <pjmaline at gmail.com> wrote:

> Hi,
>
> I just installed the yt development version
> http://hg.yt-project.org/yt/raw/yt/doc/install_script.sh
> Version = 3.1-dev
> Changeset = dc2ade033502 (yt) tip
> into ubuntu 14.04
> with
>  INST_ZLIB=0
>  INST_FTYPE=0
>
> yt seemed to install properly and it works otherwise, but it doesn't
> open any windows when I'm trying to show an image, e.g.,
> when running the script
> http://yt-project.org/doc/quickstart/3)_Simple_Visualization.py
> line by line in ipython:
> p = yt.ProjectionPlot(ds, "y", "density")
> p.show()   #doesn't open a window
> In [35]: p.show()
> <yt.visualization.plot_window.ProjectionPlot at 0x7fe1897941d0>
> However, saving the image works:
> p.save()
>
> When I run that script directly with python, I get the following error:
> Traceback (most recent call last):
>   File "3)_Simple_Visualization_short.py", line 28, in <module>
>     p.show()
>   File
> "/home/.../yt/yt-x86_64/src/yt-hg/yt/visualization/plot_container.py",
> line 622, in show
>     raise YTNotInsideNotebook
> yt.utilities.exceptions.YTNotInsideNotebook: This function only works
> from within an IPython Notebook.
>
> I'm using
> ipython --matplotlib
> from pylab import *
> and e.g. plot() and figure() open a window normally. Is there a way to
> open a window with yt's show() and other functions
> using ipython and python, or does that really require IPython Notebook?
>

Hi Johanna,

This is a known issue:

https://bitbucket.org/yt_analysis/yt/issue/660/support-for-interactive-mpl-backends

We had a recent discussion about this on the dev mailing list:

http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2014-November/013944.html

So it's not impossible, but it will take some work.  I've wanted to get
this set up for a while, but need to complete my Ph.D. before I can focus
on this.  If someone else wants to step up and work on this, I think that
would be an excellent contribution.

For now you do need to work inside of the IPython notebook if you want to
interactively work with yt plots.

You can also manually create your plots using e.g. FixedResolutionBuffer
and pyplot.

Cheers,
> Johanna
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20141202/fd541af8/attachment.html>


More information about the yt-users mailing list