Skip to content

Commit

Permalink
Guard against pdf output in IPython display hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 13, 2017
1 parent 26d2072 commit f65995e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 10 additions & 1 deletion holoviews/ipython/display_hooks.py
Expand Up @@ -49,7 +49,12 @@ def render(obj, **kwargs):
return render_anim(obj)

backend = Store.current_backend
return Store.renderers[backend].html(obj, **kwargs)
renderer = Store.renderers[backend]

# Drop back to png if pdf selected, notebook PDF rendering is buggy
if renderer.fig == 'pdf':
renderer = renderer.instance(fig='png')
return renderer.html(obj, **kwargs)


def single_frame_plot(obj):
Expand Down Expand Up @@ -153,7 +158,11 @@ def element_display(element, max_frames, max_branches):
backend = Store.current_backend
if type(element) not in Store.registry[backend]:
return None

# Drop back to png if pdf selected, notebook PDF rendering is buggy
renderer = Store.renderers[backend]
if renderer.fig == 'pdf':
renderer = renderer.instance(fig='png')
return renderer.html(element, fmt=renderer.fig)


Expand Down
4 changes: 0 additions & 4 deletions holoviews/plotting/mpl/renderer.py
Expand Up @@ -272,10 +272,6 @@ def validate(cls, options):
"""
Validates a dictionary of options set on the backend.
"""
if options['fig']=='pdf':
outputwarning.warning("PDF output is experimental, may not be supported"
"by your browser and may change in future.")

if options['backend']=='matplotlib:nbagg' and options['widgets'] != 'live':
outputwarning.warning("The widget mode must be set to 'live' for "
"matplotlib:nbagg.\nSwitching widget mode to 'live'.")
Expand Down

0 comments on commit f65995e

Please sign in to comment.