How to make opaque scatter plot in matplotlib


Lucas Gruwez

When making a scatter plot in matplotlib, I found that when I change the size of the dots, they become transparent. How can I prevent this from happening?

I've already tried alpha=1, facecolor='k' but none of these seem to work

Example code

X = np.random.normal(0,1,5000)
Y = np.random.normal(0,1,5000)

fig, ax = plt.subplots(1,2, figsize=(6,3), dpi=288)

ax[0].scatter(X,Y, s=.01, c='k')
ax[1].scatter(X,Y, s=1, c='k')



Notice how the larger dots are opaque and filled in, whilst the smaller ones seem transparent, and have a white facecolor. How do I get the smaller ones to be filled in as well?

Continue reading...