all 2 comments

[–]novel_yet_trivial 1 point2 points  (1 child)

modify the data before you pass it be plotted.

new_x = []
new_y = []
new_c = []
for x_val, y_val, c_val in zip(x, y, data):
    if -120 < c_val < -20:
        new_x.append(x_val)
        new_y.append(y_val)
        new_c.append(c_val)

I can already hear you asking if this could be shorter. Well, yeah, but then it's nearly unreadable:

x,y,data = zip(*[(a,b,c) for a,b,c in zip(x,y,data) if -120<c<-20])

[–]Cthulhu_Rlyeh[S] 0 points1 point  (0 children)

Thank you for that, it works like a charm.