Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Can't edit layouts with cufflinks

I am trying to use cufflinks to plot some charts on jupyter notebook. However, this method doesn’t seem to work. An error “AttributeError: ‘Layout’ object has no attribute ‘get’” shows up. Any ideas?

layout=df.figure()[‘layout’]
layout[‘xaxis’][‘showgrid’]=False
df.iplot(layout=layout, x=‘x’, y=‘y’, kind=‘bar’)

Hi @junh.tan,

Try updating your cufflinks to the latest version. Support for plotly.py version 3 was added relatively recently.

Hope that helps! And if not, please include the versions of plotly.py and cufflinks that you have installed.

-Jon

Hi @jmmease,

My cf version is 0.14.5. Plotly.py version is 3.3.0.

Hi @junh.tan,

It looks like support for plotly.py version 3 was added in cufflinks 0.14, so your version should be new enough. In that case, I recommend opening a bug report with the cufflinks project at https://github.com/santosjorge/cufflinks/issues.

Perhaps cufflinks doesn’t handle passing a plotly.py graph_objs.Layout object into iplot. You could try converting it into a dict first:

df.iplot(layout=layout.to_plotly_json(), x='x', y='y', kind='bar')

-Jon

Hi @jmmease,

Converting it to a dict first works. Thank you!

1 Like