I\'m wondering if it is possible to have individual alpha values for each point to be plotted using the scatter
function of Matplotlib. I need to plot a set of
You can use the color argument and a colormap with alpha.
cmap
linearly increases the alpha value from 0 to 1.
import numpy as np
import matplotlib.pylab as plt
from matplotlib import colors
c='C0'
xs = np.arange(10)
fig, ax = plt.subplots(1, 1)
cmap = colors.LinearSegmentedColormap.from_list(
'incr_alpha', [(0, (*colors.to_rgb(c),0)), (1, c)])
ax.scatter(xs, xs, c=xs, cmap=cmap, ec=None, s=10**2)
plt.show()