a=[[x1, y1, cat1], [x2, y2, cat1], ..., [x8, y8, cat1], [x9, y9, cat2], ..., [x34, y34, cat2], [x35, y35, cat3],...]

and I don't know beforehand how many diffferent categories there will be or how long they will be.

I would like to make a plot like this:

ax.plot(a[0:i1, 0], a[0:i1, 1], label=cat1)

ax.plot(a[i1:i2, 0], a[i1:i2, 1], label=cat2)

ax.plot(a[i2:i3, 0], a[i2:i3, 1], label=cat3)

...

where i1, i2... are the indices where the data set changes fomt cat1 to cat2, cat2 to cat3...

Does anybody see an easy way of coding this?

Thanks,

Armando.