Black Lives Matter. Please consider donating to Black Girls Code today.

Plotly Figure Factory subplots

Hello,
I am using python 2.7 and plotly version 3.3.0.
I am trying to run an example from the documentation to create subplots of figure factory figures (https://plot.ly/python/figure-factory-subplots/)

When running the first example it gives an error:
AttributeError: ‘Layout’ object has no attribute ‘xaxis2’

Can someone please have a look.
Many thanks

Hi @bobim,
It looks like this tutorial hasn’t been update to plotly.py version 3 yet. I opened a documentation issue here https://github.com/plotly/documentation/issues/1107.

Here are a few things to update (this might not be everything but hopefull it gets you a bit further)

  1. Assign an empty dict to xaxis2 properties before calling .update
fig2.layout.xaxis2 = {}
fig2.layout.xaxis2.update({'anchor': 'y2'})

fig2.layout.yaxis2 = {}
fig2.layout.yaxis2.update({'anchor': 'x2', 'domain': [0, .45]})
  1. Replace fig.data.extend() with += operator
# fig1.data.extend(fig2.data)
fig1.data += fig2.data

Hope that helps!
-Jon