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

Support for multiple display output formats in the notebook #355

Merged
merged 3 commits into from Dec 13, 2015

Conversation

jlstevens
Copy link
Contributor

This PR address issue #351 and makes our display system even more flexible.

You can now enable multiple display formats simultaneously (default is HTML only as before). For instance, you can now set:

hv.notebook_extension(display_formats=['html','png'])

This will display everything as normal, but also render and save PNG data (for elements) into the notebook so that it can be used by nbconvert. As extra rendering is done, running the notebook is slower and of course HoloMaps cannot be exported as PNG unless you select a single frame to display.

You can also do:

hv.notebook_extension(display_formats=['png'])

Which will force you to address HoloMaps for nbconvert and will also be faster to render. That said, your output will no longer be nicely centered due to how IPython displays images (out of our control).

The 'html' format is supported by everything but any other format is backend dependent. For instance, if you switch to Bokeh and ask for PNGs, you'll get text reprs instead (Bokeh currently doesn't export to PNG).

@philippjfr
Copy link
Member

Looks good, great feature to have and it integrates pretty cleanly with the existing rendering and display system. Basically we now support output to different IPython backends and could easily implement implement display output to for new frontends.

philippjfr added a commit that referenced this pull request Dec 13, 2015
Support for multiple display output formats in the notebook
@philippjfr philippjfr merged commit abe6e6d into master Dec 13, 2015
@jbednar
Copy link
Member

jbednar commented Dec 13, 2015

Great!

@philippjfr
Copy link
Member

Just tested it using Atom and Hydrogen, with both 'png' and 'svg', it displays plots nicely! Even the magics work.

screen shot 2015-12-13 at 3 38 56 am

PS: In case you're not familiar, the watch list on the right updates every time you execute code on the left. So you can watch some variable by wrapping it in a holoviews object in the watch pane.

@jlstevens
Copy link
Contributor Author

@philippjfr Thanks for testing it with Hydrogen! It is really cool to see HoloViews working in something other than Jupyter Notebook. In theory, Hydrogen could even support our javascript widgets (as Hydrogen is is built on Atom, it has access to Javascript and a proper rendering engine).

@jbednar
Copy link
Member

jbednar commented Dec 14, 2015

Neat!

@majidaldo
Copy link

what would it take for hydrogen to display the ipython widgets?

@jbednar
Copy link
Member

jbednar commented May 22, 2017

ipywidgets is a separate project, and isn't used by HoloViews. Not sure how much work it would take to get the JavaScript widgets that it does use working...

@jlstevens
Copy link
Contributor Author

jlstevens commented May 22, 2017

I think in this case the question is about the HoloViews widgets.

A while back I do think I got a slider working with hydrogen. I can try again but my worry is that if I do get it working, none of us use hydrogen to make sure anything we add to HoloViews stays working and supported.

@jlstevens
Copy link
Contributor Author

I had another go at getting the widgets working with nteract but without success. When we get round to the widget Javascript code refactor we should look into some way of generating JS code that is self contained and includes all the necessary dependencies.

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

Successfully merging this pull request may close these issues.

None yet

4 participants