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

Announcing plotly.py 3.3.0

I’m happy to announce that plotly.py version 3.3.0 has been released and is available on PyPI and the plotly anaconda channel.

This version includes many new features and fixes including support for polar bar charts, stacked area charts, click-to-select, easy JSON export, pickle and deepcopy support, and more!

See the CHANGELOG for more details, or checkout the release notebook to see the new features in action.

As always, if you’re using plotly.py in JupyterLab please pay careful attention to the versions of JupyterLab and associated extensions as listed in the README.

Happy plotting!

Since upgrading to plotly 3 my code creating offline plots is broken. I get the following error:
AttributeError: ‘Layout’ object has no attribute 'get’

I’m using a typical layout similar to examples posted on the website at https://plot.ly/python/line-and-scatter/
Just showing layout and the generation of the plot for brevity…

layout = go.Layout(
        showlegend=True,
        hovermode = 'closest',
        width=1000,
        height=400,
        font=dict(
            family='Calibri, sans-serif',
            size=18,
            color='rgb(0,0,0)'),

        xaxis = dict(
            type='date',
            linewidth=1,
            tickangle=-45,
            tickformat='%b-%Y', # 21-SEP-2017
            tickfont=dict(
                size=12
                )
            ),
        yaxis = dict(
            linewidth=1,
            tickfont=dict(
                size=12
                )
            ),
        barmode='stack'

    )
layout.update(title='My Title')
figure = {'data':data_reqs, 'layout':layout}
plotly.offline.plot(figure, filename='html\chart_example.html', validate=False, auto_open=False)

It looks like I just need to wait for the website to update their examples. I looked through the migration guide and see there are a lot of changes to objects/structure. I’ll just stick to 2.7.0 for now.

Hi @robertpdx,

Glad you found your way to the migration guide. In this case, I think all you need to do is remove the validate=False argument.

We probably need to be clearer about this in the docstrings/documentation, but setting validate=False basically means “trust me, I’m passing in a dict with the right structure”. In this case you’re passing in figure as a dict but it includes a go.Layout object inside, and in version 3 the plotly.graph_objs objects are no longer dict subclasses. When validate=True (the default) plotly.py will recurse down the structure and straighten this out.

Hope that helps!
-Jon

Thank you! That did the trick.

I had turned off validation for a lazy way of dealing with empty data lists. I’ve fixed that now to skip any plots with data len of 0.

1 Like