Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotly.express line documentation error in line_shape #2812

Open
abogaard opened this issue Jun 12, 2020 · 4 comments
Open

plotly.express line documentation error in line_shape #2812

abogaard opened this issue Jun 12, 2020 · 4 comments

Comments

@abogaard
Copy link

Hello, I am trying to pass line_shape='spline' as documented (https://plotly.com/python-api-reference/generated/plotly.express.line.html#plotly.express.line) but am getting the following error:

` Invalid value of type 'builtins.str' received for the 'shape' property of scattergl.line
Received value: 'spline'

The 'shape' property is an enumeration that may be specified as:
  - One of the following enumeration values:
        ['linear', 'hv', 'vh', 'hvh', 'vhv']`
@kevbroch
Copy link

kevbroch commented Oct 7, 2020

I got tripped up by this as well. My workaround was to set render_mode="svg" so plotly.express doesn't try to created a scattergl object like it does when render_mode="auto" is set as the default.

I also tried line_shape="linear"; render_mode="auto", which works fine. So basically one has to decide on performance vs. the line_shape.

I really want splines and also didn't notice that big a difference in the performance. (my plot is probably just over the large size though)

Hoping for a better solution from the plotly team!

@alexcjohnson
Copy link
Contributor

Moving to the plotly.py repo, as there really isn't an issue in plotly.js, it's just the internal logic in px. Perhaps the right solution here is to prevent automatically switching from scatter to scattergl when spline is used? Any other options that scattergl does not support and should prevent switching? I guess another option would be if an error occurs in constructing the final scattergl objects, try switching back to scatter and see if the error disappears; if we get a new error just reraise the original one. Not sure about the performance implications of that, but it would be the most adaptable solution if these conditions change in future plotly.js versions.

@alexcjohnson alexcjohnson transferred this issue from plotly/plotly.js Oct 7, 2020
@ronak1009
Copy link

ronak1009 commented Dec 1, 2022

I am also getting the error after migrating to Python 3.9 and plotly==5.10.0
Error comes for

fig = plx.line(df,x="x", y="y", color="z", 
 labels=labels, 
 width=224, 
 height=245,
 line_shape= "spline" 
)

Error message:

{"logs": ["ERROR: \n    Invalid value of type 'builtins.str' received for the 'shape' property of scattergl.line\n        Received value: 'spline'\n\n 
   The 'shape' property is an enumeration that may be specified as:\n      - One of the following enumeration values:\n            ['linear', 'hv', 'vh', 'hvh', 'vhv']; datasheet.py:641"], "success": false, "time": 0.095167}

Does anyone know work-around to fix this issue ?

@zupdaz
Copy link

zupdaz commented Dec 24, 2022

Getting same error when I load my df from multiple csv.

fig = px.line(df, x='Size_class', y='Value', color='Comment 2', line_shape='spline')
fig.update_xaxes(type="log")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants