From f65995eb1a20090c7ccc3a999c6fa03c69284320 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Mon, 13 Mar 2017 15:37:00 +0000 Subject: [PATCH] Guard against pdf output in IPython display hooks --- holoviews/ipython/display_hooks.py | 11 ++++++++++- holoviews/plotting/mpl/renderer.py | 4 ---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/holoviews/ipython/display_hooks.py b/holoviews/ipython/display_hooks.py index 04aa3a5be8..cce547c962 100644 --- a/holoviews/ipython/display_hooks.py +++ b/holoviews/ipython/display_hooks.py @@ -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): @@ -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) diff --git a/holoviews/plotting/mpl/renderer.py b/holoviews/plotting/mpl/renderer.py index f99a64cc99..f8c6f18819 100644 --- a/holoviews/plotting/mpl/renderer.py +++ b/holoviews/plotting/mpl/renderer.py @@ -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'.")