The alpha levels are increased where the points overlap, so the darkest areas are where points are overlapping.
I would instead like the alpha levels to subtract from each other somehow - so that if there was an overlapping section it would be lighter than a section with no overlap.
Here is an example of what I mean - from left to right the points become darker as there are more overlapped:
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(20, 3))
# X and Y coordinates for red circles
red_xs = [1]
red_ys = [1]
# Plot with a large markersize
markersize = 35
alpha = 0.1
for i in range(20):
red_xs[0] += 1
for add in range(i):
ax.plot(
red_xs,
red_ys,
marker="o",
color="r",
linestyle="",
markersize=markersize,
alpha=alpha,
)
I would like the inverse of this - to be able to start with an alpha level of the point on the far right and for the point to be come fainter in the areas that overlap, which would have the result of rendering as the point in the far left as many are overlayed.
To give a more concrete example where points are no perfectly overlayed:
import matplotlib.pyplot as plt
import random
fig, ax = plt.subplots(figsize=(20, 3))
# X and Y coordinates for red circles
red_xs = [1]
red_ys = [1]
# Plot with a large markersize
markersize = 35
alpha = 0.01
random.seed(1)
for j in range(5):
red_xs = [1]
red_ys = [1]
for i in range(20):
u = 0.1
v = 0.00000001
dx = random.uniform(-u, u)
dy = random.uniform(-u, u)
red_xs[0] += 2 + dx
red_ys[0] += dy
for add in range(i):
ax.plot(
red_xs,
red_ys,
marker="o",
color="r",
linestyle="",
markersize=markersize,
alpha=alpha,
)
looks as:
For parts where there are overlapping points such as these:
The solution should render y
(where they intersect) the alpha of x
, and x
the alpha of y
. And this should work for any number of layers.