Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any function to plot similar to geom_smooth() in Plotly using python?

Tags:

python

plotly

I have made a scatterplot using Plotly (python), and i want to connect the dots using something similar to geom_smooth() function.

Something like below image : enter image description here

like image 328
sid8491 Avatar asked Jul 14 '26 22:07

sid8491


1 Answers

You should be able to do it by setting the shape='spline' when defining the line. here is the plotly example

trace2 = go.Scatter(
    x=[1, 2, 3, 4, 5],
    y=[6, 8, 7, 8, 6],
    mode='lines+markers',
    name="'spline'",
    text=["tweak line smoothness<br>with 'smoothing' in line object"],
    hoverinfo='text+name',
    line=dict(
        shape='spline'
    )
)

See an example here: plotly line charts

like image 152
tfg250 Avatar answered Jul 17 '26 16:07

tfg250



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!