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

Adding a layout shape line with custom dash lenght lists is not working #3375

Closed
dvd7587 opened this issue Sep 9, 2021 · 1 comment · Fixed by #3722
Closed

Adding a layout shape line with custom dash lenght lists is not working #3375

dvd7587 opened this issue Sep 9, 2021 · 1 comment · Fixed by #3722

Comments

@dvd7587
Copy link

dvd7587 commented Sep 9, 2021

Example:
plotly.graph_objects.layout.shape.Line(color='black', width=2, dash='5px,3px,3px,2px')

produces the following:

ValueError: 
    Invalid value of type 'builtins.str' received for the 'dash' property of layout.shape.line
        Received value: '5px,3px,3px,2px'

    The 'dash' property is a string and must be specified as:
      - One of the following strings:
            ['solid', 'dot', 'dash', 'longdash', 'dashdot',
            'longdashdot']
      - A number that will be converted to a string

Moreover, the documentation and the Line docstring state that it should be allowed, but the layout.shape.Line.dash property docstring states otherwise.

@kvanderwijst
Copy link

Had the same issue. After looking around a bit, I found that the problem is that the DashValidator from validators/layout/shape/line inherits from StringValidator instead of DashValidator (same actually for validators/scattersmith/line and validators/layout/newshape/line). Changing this line:

class DashValidator(_plotly_utils.basevalidators.StringValidator):

to this:

class DashValidator(_plotly_utils.basevalidators.DashValidator):

in the file C:\Users\[USER]\Anaconda3\Lib\site-packages\plotly\validators\layout\shape\line\_dash.py on Windows (probably similar on Linux/Mac) fixes the issue. Not sure how to make a patch of this though.

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

Successfully merging a pull request may close this issue.

2 participants