Search code examples
plotlyplotly-dashscatter-plotplotly-python

Plotly: How to set an interval of '10' on both the axis where the range is as follows [0,100]


How to set an interval of '10' on both the axis where the range is as follows [0,100]

Plotly Pic for reference


Solution

  • You can set the starting tick and tick spacing like this (using some sample data that has a similar range to yours):

    fig = go.Figure(go.Scatter(x=[0,105],y=[20,102], mode='markers'))
    fig.update_layout(
        xaxis = dict(
            tickmode = 'linear',
            tick0 = -10,
            dtick = 10
        ),
        yaxis = dict(
            tickmode = 'linear',
            tick0 = 0,
            dtick = 10
        )
    )
    

    enter image description here