Transparent colors
Plot data using transparent (alpha) value t
Plot data using transparent (alpha) value t
import matplotlib.pyplot as plt
import numpy
# generate dataset of 100 samples
x=numpy.random.uniform(-5,5,size=100)
y=numpy.random.uniform(-5,5,size=100)
# generate 100 random transparent values
# range between 0 (fully transparent) and 1 (no transparency)
t=numpy.random.rand(100)
# create color settings (red, green, blue, alpha) for each data point, using t as transparent alpha value
dotcolors=[(0.2, 0.4, 0.6, a) for a in t]
# plot
plt.scatter(x, y, c=dotcolors, s=200, edgecolors='None')
plt.show()