Conversation
Add the auto-resize logic when figure is displayed in the classic notebook using iplot.
When 'cdn', the resulting html file/div includes a script tag reference to the plotlyjs cdn. When 'directory', the resulting html file/div includes a script tag reference to a plotly.min.js bundle in the same directory as the html file. If output_type is 'file' then this plotly.min.js bundle is created in the output directory if it doesn't already exist.
|
0cbcce7 adds When When |
This makes it possible to specify an alternative CDN or offline location for plotly.js
|
69dc7ba Adds option to specify |
|
very nice! Thanks for picking this one up 👍 |
|
|
||
| def _build_resize_script(plotdivid): | ||
| resize_script = ( | ||
| '' |
There was a problem hiding this comment.
Remove empty string here
| # Some offline tests produce an html file. Make sure we clean up :) | ||
| try: | ||
| os.remove('temp-plot.html') | ||
| # Some tests that produce temp-plot.html] |
There was a problem hiding this comment.
remove ']' character
Overview
This PR includes a variety of small improvements to html generation in
plotly.offline.plotandplotly.offline.iplot.Changes
offline.plotwhenoutput_type='div'andinclude_plotlyjs=False. See Resizable, minimal, embeddable output from plotly.offline.plot #1043 for discussion. cc @mchels @ryancollingwood @spencercal'cdn','directory', and path stringinclude_plotlyjsoptions inoffline.plot'cdn', the resulting html file/div includes a script tag reference to the plotlyjs cdn. This addresses part of Raise warning in plotly.offline.plot when output_type='file' and include_plotlyjs=False #1227'directory', the resulting html file/div includes a script tag reference to a plotly.min.js bundle in the same directory as the html file. If output_type is'file'then this plotly.min.js bundle is created in the output directory if it doesn't already exist. This is an alternative approach towards the goal of Reduce size V3 #688'.js', the resulting html file/div includes a script tag that references this exact path. This can be used to point to a plotly.js bundle from an alternative CDN.