Skip to content

Custom values for griddash, e.g. '10px' don't work (plotly.js 2.12.0) #3710

Closed
@LiamConnors

Description

@LiamConnors

Custom values for griddash, e.g. '10px' don't work (plotly.js 2.12.0)

Example:

import plotly.express as px
df = px.data.iris()

fig = px.scatter(df, x="sepal_width", y="sepal_length", facet_col="species")
fig.update_xaxes(tickcolor="black", tickwidth=2, ticklen=10, ticklabelmode="period", griddash='10px')
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='LightPink')

fig.show()

Gives the following error

ValueError: 
    Invalid value of type 'builtins.str' received for the 'griddash' property of layout.xaxis
        Received value: '10px'

    The 'griddash' 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

@archmoj, should it work like this? That throws an error
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='LightPink', griddash='10px')

Originally posted by @LiamConnors in #3693 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions