Saturday, 14 December 2019

matplotlib scatter color mapping

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(100)
y = x + np.random.uniform(-5, 5, 100)
t = x
plt.scatter(x, y, c=t, cmap='gist_rainbow')
plt.show()

reference:

No comments:

Post a Comment