In short: I am using matplotlib
to draw a scater plot and a surface. I have run into a problem so that the surface is always drawn on top of the points and not behind as it should be.
I want to solve this by preprocessing color of the points so that when overlayed by the surface I obtain the "original color", this way the surface will appear behind the points. I specify color
of the points using HEX
values.
The problem with the surface and points I encounter is similar to the problem described here.
Here are the details:
I have a 3D scatter plot of Blue and Red points in Matplotlib:
self.subplot_3d = self.subplot.scatter(x_red, y_red, z_red, s = 150, c = RED, depthshade = False, lw = 0, alpha = 1)
self.subplot_3d = self.subplot.scatter(x_blue, y_blue, z_blue, s = 150, c = BLUE, depthshade = False, lw = 0, alpha = 1)
Points are linearly separable - there exists a separating plane, which separates red points and blue points. I draw the plain using
self.plane = self.subplot.plot_surface(X, Y, Z, antialiased = True, color = RED_BACKGROUND, alpha = 0.5)
I want to draw two plots: in the first, there is no separating plain drawn - only the red and blue points(left). And in the second there is a separating plane (right).
Once the separating plane is drawn, I was not able to force the plane to be drawn between red and blue points (as expected from the plane equation and the position of the points) The plane always appears on top of all the points.
The solution I was thinking about is the following: "preprocess" the color of the blue points so that when overlayed with the color of the transparent plane I obtain the original blue color. In this way the points will appear to be on top of the plane, and it should "solve" my current problem.
I have used HEX
color specification, I am not sure how the color mix when I use transparency in matplotlib. I am looking for reference or suggestion how I should "counteract" red transparent color of the plane with, say, alpha = 0.2
.
In another words I would like to achive something like sepicifiying:
Blue = #0000FF
Red = #FF0000
PreProcBlue = "#-FF00FF"'
so that PreProcBlue + Red = Blue
.
Thanks!