-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
offline.plot/iplot improvements #1234
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 👍 |
plotly/offline/offline.py
Outdated
@@ -389,6 +394,17 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly', | |||
ipython_display.display(ipython_display.HTML(script)) | |||
|
|||
|
|||
def _build_resize_script(plotdivid): | |||
resize_script = ( | |||
'' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty string here
|
||
class PlotlyOfflineBaseTestCase(TestCase): | ||
def tearDown(self): | ||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove ']' character
Overview
This PR includes a variety of small improvements to html generation in
plotly.offline.plot
andplotly.offline.iplot
.Changes
offline.plot
whenoutput_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_plotlyjs
options 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.