I want to plot scatter points over a continuous line. The colors I chose have some value of alpha<1
. When I draw the point on top of the line, the result becomes more opaque (which is expected). Here's a picture:
And here's the relevant source code:
import matplotlib.pyplot as plt
plt.style.use("default")
color = (0.4, 0.1, 0.9, 1.0)
color50 = (0.4, 0.1, 0.9, 0.5)
# A line
fig, ax = plt.subplots(1,1,figsize=(6,4))
ax.plot([1,2],[1,2], lw = 10, color =color50)
# Point A
ax.scatter(1.4,1.4, s = 500, color =color)
ax.text(1.38,1.47,"A",)
# Point B
ax.scatter(1.5,1.5, s = 500, color =color50,alpha = 1.0)
ax.text(1.48,1.57,"B",)
# Point C
ax.scatter(1.7,1.7, s = 500, color =color50)
ax.text(1.68,1.77,"C",)
# Point D
ax.scatter(1.7,1.3, s = 500, color =color50)
ax.text(1.68,1.37,"D")
The result I desire would look somewhat like point D
on the line without the line being more opaque (as it is the case for C
).