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

Problems opting out of the default template #1870

Closed
nicolaskruchten opened this issue Nov 5, 2019 · 2 comments
Closed

Problems opting out of the default template #1870

nicolaskruchten opened this issue Nov 5, 2019 · 2 comments

Comments

@nicolaskruchten
Copy link
Contributor

Original observation: neither call here suppresses the default template:

from plotly.offline import iplot
iplot(dict(data=[dict(type="scatter")], layout=dict(template="none")))
iplot(dict(data=[dict(type="scatter")], layout=dict(template={})))

Popping the hood on that method, it looks like it's doing the equivalent of:

import plotly.graph_objects as go
fig = go.Figure(dict(data=[dict(type="scatter")], layout=dict(template={})))

import plotly.io as pio
pio.show(fig.to_dict())

The problem being that fig.to_dict() here returns {'data': [{'type': 'scatter'}], 'layout': {}} and when pio.show() gets it, it seems to applies the default template. This doesn't happen with pio.show(fig.to_dict(), validate=False) or with pio.show(fig.update_layout(template={}, overwrite=True).to_dict(), validate=False).

So should pio.show() be applying the default template at all here? (Hard to say "no" here unless we do validation somehow without just creating a Figure ?)

And/or should fig.to_dict() include the template: {} to signal to functions like pio.show() that no defaulting should happen?

@nicolaskruchten
Copy link
Contributor Author

@jonmmease would love your thoughts on this!

@nicolaskruchten
Copy link
Contributor Author

And/or should fig.to_dict() include the template: {} to signal to functions like pio.show() that no defaulting should happen?

let's do this, but for 4.4

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

No branches or pull requests

1 participant