Plot‎ > ‎matplotlib‎ > ‎

Transparent colors

Plot data using transparent (alpha) value t

import matplotlib.pyplot as plt
import numpy

# generate dataset of 100 samples 

# generate 100 random transparent values
# range between 0 (fully transparent) and 1 (no transparency)


# 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')