Skip to content
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

Merged
merged 6 commits into from
Oct 23, 2018
Merged

offline.plot/iplot improvements #1234

merged 6 commits into from
Oct 23, 2018

Conversation

jonmmease
Copy link
Contributor

@jonmmease jonmmease commented Oct 22, 2018

Overview

This PR includes a variety of small improvements to html generation in plotly.offline.plot and plotly.offline.iplot.

Changes

Add the auto-resize logic when figure is displayed in the classic
notebook using iplot.
@jonmmease jonmmease added this to the v3.4.0 milestone Oct 22, 2018
@jonmmease
Copy link
Contributor Author

1494538 Adds resize support for iplot use in the classic notebook. This PR now superceeds #970.

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.
@jonmmease
Copy link
Contributor Author

0cbcce7 adds 'cdn' and 'directory' include_plotlyjs options in offline.plot

When 'cdn', the resulting html file/div includes a script tag reference to the plotlyjs cdn. This addresses part of #1227

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. This is an alternative approach towards the goal of #688

@jonmmease jonmmease changed the title Support auto-resize in offline.plot with output_type='div' and include_plotlyjs=False offline.plot/iplot improvements Oct 22, 2018
This makes it possible to specify an alternative CDN or offline
location for plotly.js
@jonmmease
Copy link
Contributor Author

69dc7ba Adds option to specify include_plotlyjs as a path/url to a *.js file. This makes it possible to point the resulting html file/div to an alternative CDN location.

@fu
Copy link

fu commented Oct 23, 2018

very nice! Thanks for picking this one up 👍

@@ -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 = (
''
Copy link
Contributor Author

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]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove ']' character

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants