Removing Loop from Numpy XOR
Since (a &lt; 0 and b &gt; 0) or (a &gt; 0 and b &lt; 0) can be summarized as a*b &lt; 0, moreover * and &lt; work on vectors, we get the one-liner:
plt.scatter(X[0], X[1], c=X[0]*X[1] &lt; 0)