From 497f3edd56b7306cbed2ad8df73d679a2c784634 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Mon, 5 Nov 2018 18:51:17 -0500 Subject: [PATCH] Fix iplot resize in classic notebook that was broken by https://github.com/plotly/plotly.py/pull/1250 --- plotly/offline/offline.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plotly/offline/offline.py b/plotly/offline/offline.py index 98b00066bb7..1ccb2e3c1ee 100644 --- a/plotly/offline/offline.py +++ b/plotly/offline/offline.py @@ -98,13 +98,13 @@ def get_plotlyjs(): return plotlyjs -def _build_resize_script(plotdivid): +def _build_resize_script(plotdivid, plotly_root='Plotly'): resize_script = ( '' - ).format(id=plotdivid) + ).format(plotly_root=plotly_root, id=plotdivid) return resize_script @@ -450,7 +450,8 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly', ) resize_script = '' if width == '100%' or height == '100%': - resize_script = _build_resize_script(plotdivid) + resize_script = _build_resize_script( + plotdivid, 'window._Plotly') display_bundle['text/html'] = plot_html + resize_script display_bundle['text/vnd.plotly.v1+html'] = plot_html + resize_script