When you add a rangeslider, its yaxis container gets _template: null inserted into the input (layout) object. This isn't an attribute, so it should only be inserted in the fullLayout object, not the layout object.
This doesn't cause problems directly in plotly.js, but it should be fixed here because it can cause problems in Dash if you reload a figure into Python after displaying it on the page, for example:
Which gives the error (from the line fig = go.Figure(fig_raw) on the second callback call):
ValueError: Invalid property specified for object of type
plotly.graph_objs.layout.xaxis.rangeslider.YAxis: '_template'
Until this is fixed, removing the problematic container (you could even remove just _template) can avoid the error:
# add these lines before fig = go.Figure(fig_raw)
if 'rangeslider' in fig_raw['layout']['xaxis']:
del fig_raw['layout']['xaxis']['rangeslider']['yaxis']
When you add a rangeslider, its
yaxis
container gets_template: null
inserted into the input (layout
) object. This isn't an attribute, so it should only be inserted in thefullLayout
object, not thelayout
object.https://codepen.io/alexcjohnson/pen/vYjOvgJ
This doesn't cause problems directly in plotly.js, but it should be fixed here because it can cause problems in Dash if you reload a figure into Python after displaying it on the page, for example:
Which gives the error (from the line
fig = go.Figure(fig_raw)
on the second callback call):Until this is fixed, removing the problematic container (you could even remove just
_template
) can avoid the error: