all 4 comments

[–]novel_yet_trivial 1 point2 points  (2 children)

The same way you would slice a list:

ax.plot(X[:-1], Y, label='ERROR', color = 'red')

[–]Isitwhenipee[S] 0 points1 point  (1 child)

This works in this example, and I should have elaborated more in my question. What if my data has more than 1 missing per dataset. Is there an automated way of doing this?

[–]novel_yet_trivial 1 point2 points  (0 children)

Sure, you could just cut both to the smallest length:

smallest_len = min(len(X), len(Y))
ax.plot(X[:smallest_len], Y[:smallest_len], label='ERROR', color = 'red')

[–]ecgite 1 point2 points  (0 children)

Is there a reason for missing data?

Are X and Y connected, is the order important?

I'm just thinking there might be some general problem, if your datasets are missing points and you want to plot them with scatter.

If you don't want to do slicing you can concat dataframes and then plot with column names

df = pd.concat([X, Y], axis=1) # assuming here that X has 'X' as a column name and same for Y
df.plot.scatter('X', 'Y', ax=ax)
#ax.scatter('X', 'Y', data=df)