Black Lives Matter. Please consider donating to Black Girls Code today.

Scatter plot line not smooth

I’m creating a scatter plot with mode='line+markers". However, the line is not smooth. Instead of connecting the nearest next marker. Rather it connects with the marker that is furthest away. The result is that it creates a zigzag line where it could create a much smoother line. Its odd since I’ve created other plots with almost the same data and it is smooth. Any suggestions on how to handle this problem.

Hi @nagin,

The lines will connect points in the order that they are passed to the scatter.x and scatter.y properties, so you’ll need to sort them into the order that you want them connected in.

Hope that helps,
-Jon

I discovered that the problem was that the series was a string series. After converting it to int it worked as expected.

1 Like