Reputation: 1325
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)
Upvotes: 2
Views: 6286
Reputation: 4840
import matplotlib.pyplot as plt
plt.scatter(*zip(*X))
plt.show()
Upvotes: 1
Reputation: 897
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()
Upvotes: 7