[yt-users] How do I preview a plot?

Nathan Goldbaum nathan12343 at gmail.com
Mon Mar 6 08:15:34 PST 2017


Currently that's not supported outside of a Jupyter notebook.

That said, in the next major release of yt (yt 3.4) we will add support for
this. If you'd like to try it out right now you'll need to install yt from
the "yt" branch of the mercurial repository. There are instructions on how
to build yt from source here:

http://yt-project.org/docs/dev/installing.html#installing-yt-using-pip-or-from-source

Here's some description in the docs for the in-development version of yt
where this feature is available already:

http://yt-project.org/docs/dev/visualizing/plots.html#viewing-plots

Basically you just do:

import yt
yt.toggle_interactivity()

And the next time you call plot.show() it should pop up a GUI plot window
using your default matplotlib backend. Unfortunately we can't make this
behavior the default since yt is often used in headless ssh sessions on a
supercomputer where using an interactive GUI backend would cause a crash.

-Nathan

On Mon, Mar 6, 2017 at 8:08 AM, (Jan) Christoph Bischko <
christoph.bischko at gmail.com> wrote:

> Hi all,
>
> This is a newbie-question concerning plots, so feel free to ignore it.
>
> I'm doing something like
>
> > ds = yt.load( fname, unit_base=unit_base, bounding_box=bbox )
> > px = yt.ProjectionPlot( ds, 'y', ('gas', 'density') )
> > px.save()
>
> Which saves the plot that I want to a file.
>
> How can preview the same plot in a window?
> Basically I'm looking for a yt equivalent to `matplotlib.pyplot.show()`
> instead `px.save()`, which corresponds more to a `plt.savefig()` in
> matplotlib.
>
> I'm aware that `px.show()` would work in jupyter/ipython notebook.
> Unfortunately outside it throws
>
> > yt.utilities.exceptions.YTNotInsideNotebook: This function only works
> from within an IPython Notebook
>
> Cherrs,
> Christoph
>
>
> _______________________________________________
> 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/20170306/807abb87/attachment.html>


More information about the yt-users mailing list