Skip to content

plotly.express line documentation error in line_shape #2812

Closed

Description

@abogaard

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']`

Activity

  1. kevbroch commented on Oct 7, 2020

    @kevbroch

    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!

  2. alexcjohnson commented on Oct 7, 2020

    @alexcjohnson
    Collaborator

    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.

  3. ronak1009 commented on Dec 1, 2022

    @ronak1009

    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 ?

  4. zupdaz commented on Dec 24, 2022

    @zupdaz

    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")
    
  5. gvwilson commented on Jul 5, 2024

    @gvwilson
    Contributor

    Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Alternatively, if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions