-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
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?