|
29 | 29 |
|
30 | 30 | from plotly import exceptions, files, session, tools, utils
|
31 | 31 | from plotly.api import v1, v2
|
32 |
| -from plotly.basedatatypes import BaseTraceType, BaseFigure |
| 32 | +from plotly.basedatatypes import BaseTraceType, BaseFigure, BaseLayoutType |
33 | 33 | from plotly.plotly import chunked_requests
|
34 | 34 |
|
35 | 35 | from plotly.graph_objs import Scatter
|
@@ -146,6 +146,8 @@ def iplot(figure_or_data, **plot_options):
|
146 | 146 |
|
147 | 147 | if isinstance(figure_or_data, dict):
|
148 | 148 | layout = figure_or_data.get('layout', {})
|
| 149 | + if isinstance(layout, BaseLayoutType): |
| 150 | + layout = layout.to_plotly_json() |
149 | 151 | elif isinstance(figure_or_data, BaseFigure):
|
150 | 152 | layout = figure_or_data.layout.to_plotly_json()
|
151 | 153 | else:
|
@@ -1851,6 +1853,8 @@ def icreate_animations(figure, filename=None, sharing='public', auto_open=False)
|
1851 | 1853 |
|
1852 | 1854 | if isinstance(figure, dict):
|
1853 | 1855 | layout = figure.get('layout', {})
|
| 1856 | + if isinstance(layout, BaseLayoutType): |
| 1857 | + layout = layout.to_plotly_json() |
1854 | 1858 | elif isinstance(figure, BaseFigure):
|
1855 | 1859 | layout = figure.layout.to_plotly_json()
|
1856 | 1860 | else:
|
|
0 commit comments