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

(Jan) Christoph Bischko christoph.bischko at gmail.com
Mon Mar 6 08:26:52 PST 2017


thanks for the lightning-fast reply!

On 06.03.2017 17:15, Nathan Goldbaum wrote:
> 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()

Thank you Nathan, that is convenient and amazing.

I just found http://yt-project.org/doc/visualizing/manual_plotting.html,
which I will use as a workaround for the time being as I also need some
(limited) backward-compatibility.

> 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.

Unless you couple it with something like:

    import os
    if 'DISPLAY' not in os.environ: matplotlib.use('agg')

Which, I admit, could be improved upon. However, there should be less
crude hacks to detect the headless case.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170306/980772da/attachment.sig>

More information about the yt-users mailing list