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

Chart Studio get plotly version for python export

I’m very enthusiastic about the possibility to use getfigure to get a figure designed in Chart Studio it’s great for my workflow. But I ran into a very frustrating issue.

When I ran getfigure to get a figure I designed in Chart Studio I got a ValueError due to the format of the colorbar. My guess was a version compatibility issue, I was using plotly version 3.5 locally so I (randomly) downgraded to version 2.7 and it worked.

My question is : is there some way to get the information about the python API version compatible with the object rendered by the plotly.plotly.getfigure method? Or to get the version of the javascript plotly library used by Chart Studio? 3.5.0 and Chart Studio are both running Plotly.js 1.43.1

Can you tell us more about the error you’re seeing?

Ok some more info - with plotly version 3.5.0, and python 3.5.2:

import plotly.plotly as py

I get the following error:

Invalid value of type ‘builtins.list’ received for the ‘colorscale’ property of scatter.marker
Received value: []

The 'colorscale' property is a colorscale and may be
specified as:
  - A list of 2-element lists where the first element is the
    normalized color level value (starting at 0 and ending at 1), 
    and the second item is a valid color string.
    (e.g. [[0, 'green'], [0.5, 'red'], [1.0, 'rgb(0, 0, 255)']])
  - One of the following named colorscales:
        ['Greys', 'YlGnBu', 'Greens', 'YlOrRd', 'Bluered', 'RdBu',
        'Reds', 'Blues', 'Picnic', 'Rainbow', 'Portland', 'Jet',
        'Hot', 'Blackbody', 'Earth', 'Electric', 'Viridis', 'Cividis']

Do you want the full stacktrace?

Nope, that’s helpful, thanks! Looks like Chart Studio is creating JSON that doesn’t like, which is something we’ll have to resolve in Chart Studio. I’ve created an issue here if you want to track our progress: