Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viewers don't inline well in IPython notebook #368

Closed
guyer opened this issue Sep 19, 2014 · 4 comments
Closed

Viewers don't inline well in IPython notebook #368

guyer opened this issue Sep 19, 2014 · 4 comments

Comments

@guyer
Copy link
Member

guyer commented Sep 19, 2014

The [http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html IPython notebook ] is capable of inline display of Matplotlib figures via

ipython notebook --pylab inine

and FiPy viewers do appear when instantiated, but subsequent calls to viewer.plot() don't do anything useful.

It would be nice if there were a way to visualize, or even animate, the viewers within the notebook.

Imported from trac ticket #494, created by guyer on 01-29-2013 at 15:45, last modified: 01-30-2013 at 11:00

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

The basic mechanism is explained at http://stackoverflow.com/a/12389435/2019542 and a FiPy user already came up with their own implementation.

Trac comment by guyer on 01-29-2013 at 15:57

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

With the following pull request, it is possible to do

from IPython.display import clear_output
  :
  :
vw = fp.Viewer(vars=var)

for step in range(steps):
:
clear_output()
display(vw) 

Note: it is necessary to do display(vw) instead of vw.plot().

The following changes since commit 3b11fbbc097e9d023e64a61f465f07747940b96a:

  Merge branch 'ticket475-getVersion_fails_on_Py3k' into develop (2013-01-29 10:43:51 -0500)

are available in the git repository at:


  ssh://git@code.matforge.org/nist/fipy.git ticket494-Viewers_dont_inline_well_in_IPython_notebook

for you to fetch changes up to 50dd6adac5279eff89ae9c09efffcb0be7543c79:

  documentation (2013-01-29 15:53:28 -0500)

----------------------------------------------------------------
Jonathan Guyer (2):
Allow `MatplotlibViewer` to `display()` in IPython
documentation

 fipy/viewers/matplotlibViewer/matplotlibViewer.py | 9 +++++++++
 1 file changed, 9 insertions(+)

Trac comment by guyer on 01-29-2013 at 16:03

@wd15
Copy link
Contributor

wd15 commented Sep 19, 2014

Seems to work for me. Merged with 755bbc2

Trac comment by wd15 on 01-30-2013 at 11:00

@lucentdan
Copy link

Adding wait=True to clear_output() makes it cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants