Search code examples
pythonplotlyplotly-dash

Adjust the amount of jitter for a Plotly strip plot?


Is there a way to adjust the amount of jitter for a plotly strip plot? That is, the equivolent of the jitter parameter in seaborn.stripplot. I could not find anything from the plotly strip documentation. Thank you.


Solution

  • Jitter is enabled for graph updates, although it cannot be specified directly in plotly.express. 1.0 is the maximum value. Jitter is enabled from the reference example.

    import plotly.express as px
    
    df = px.data.tips()
    fig = px.strip(df, x="total_bill", y="day",)
    
    fig.update_traces(jitter=1.0)
    fig.show()
    

    enter image description here