Change marker opacity
When a scatter plot has a lot of points, markers overlap and blend into a blob. This can be circumvented by adding transparency to the markers, causing regions with lots of overlapping markers to appear darker.
alpha parameter to
plt.scatter() to make translucent markers. In the example below, we color the markers gray by setting the
c parameter to a string value between 0 and 1.
import matplotlib.pyplot as plt import numpy as np vals = np.random.multivariate_normal([0, 0], [[4, 2], [2, 3]], 2000) # Create a scatter plot with translucent markers. plt.scatter(vals[:, 0], vals[:, 1], alpha=0.2, c='0.7') plt.show()