'How to plot an array using python
I have a graph plotted. I now need to form two random arrays,X,Y of 12 numbers between 1 and 15 . I then have to plot these on my graph. I am struggling. Can anybody help
Solution 1:[1]
from matplotlib import pyplot as plt
x = [4] // X array
y = [3] // Y array
plt.plot(x, y, marker="o", markersize=20, markeredgecolor="red", markerfacecolor="green")
plt.show()
Another simple option is to use scatter method like this
x_coordinates = [1, 2, 3]
y_coordinates = [4, 5, 6]
plt.scatter(x_coordinates, y_coordinates)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shivam Mishra |
