How to get rid of the straight line?

You still need to use keep_idx remove elements from x2 and y. Each element in keep_idx is a boolean, which will keep a value if true and will exclude a value if false. So what you need to do is index x2 and y like so:

x2 = range(0, X_inlet, length=50)
y=f.(x2)
keep_idx=Y02 .!=y
plot(-x2[keep_idx], y[keep_idx], color=:blue, label=missing)
plot!(-x2[keep_idx], -y[keep_idx], color=:blue, label=missing)
plot!(ylims=(-0.75,0.75))
1 Like