Code does not work on new version of Matplotlib

Hi @rcomer ,

Could you please explain to me what I should change to update my code to the new Matplotlib version?

In this code, the “isinstance(c, matplotlib.collections.LineCollection)” always returns False:

ax = plt.gca()
ax.scatter(X1[::n1], Y1[::n1], marker='.', alpha=0.1, label='XY')

for i,c in enumerate(ax.collections):  
            if isinstance(c, matplotlib.collections.LineCollection):

I tried some changes which do not work, I do not understand what I should write.

Thank you for your help,
Lea