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

A few renderers default updates #1571

Merged
merged 3 commits into from
May 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions plotly/io/_renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def default(self, value):
self._default_renderers = [self[name] for name in renderer_names]

# Register renderers for activation before their next use
self._to_activate.extend(self._default_renderers)
self._to_activate = list(self._default_renderers)

@property
def render_on_display(self):
Expand Down Expand Up @@ -420,17 +420,10 @@ def show(fig, renderer=None, validate=True, **kwargs):
default_renderer = 'vscode'

# Fallback to renderer combination that will work automatically
# in the classic notebook, jupyterlab, nteract, vscode, and
# nbconvert HTML export. We use 'notebook_connected' rather than
# 'notebook' to avoid bloating notebook size and slowing down
# plotly.py initial import. This comes at the cost of requiring
# internet connectivity to view, but that is a preferable
# trade-off to adding ~3MB to each saved notebook.
#
# Note that this doesn't cause any problem for offline
# JupyterLab users.
# in the classic notebook (offline), jupyterlab, nteract, vscode, and
# nbconvert HTML export.
if not default_renderer:
default_renderer = 'notebook_connected+plotly_mimetype'
default_renderer = 'plotly_mimetype+notebook'
else:
# If ipython isn't available, try to display figures in the default
# browser
Expand Down
4 changes: 2 additions & 2 deletions plotly/offline/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ def init_notebook_mode(connected=False):
raise ImportError('`iplot` can only run inside an IPython Notebook.')

if connected:
pio.renderers.default = 'notebook_connected+plotly_mimetype'
pio.renderers.default = 'plotly_mimetype+notebook_connected'
else:
pio.renderers.default = 'notebook+plotly_mimetype'
pio.renderers.default = 'plotly_mimetype+notebook'

# Trigger immediate activation of notebook. This way the plotly.js
# library reference is available to the notebook immediately
Expand Down