Assume I have the following array:
X = np.array([[1, 2], [2, 2], [2, 3], [8, 7], [8, 8], [25, 80]])
How can I make scatter plot ( matplotlib
) of X
?
scatter require 2 parameters (x, y)
import numpy as np
import matplotlib.pyplot as plt
X = np.array([[1, 2], [2, 2], [2, 3], [8, 7], [8, 8], [25, 80]])
plt.scatter(X[:,0], X[:,1])
plt.show()
import matplotlib.pyplot as plt
plt.scatter(*zip(*X))
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.