q27.py
· 397 B · Python
Sin formato
# Create 2 arrays, using MatPlotLib, plot the graph with the content of the two arrays, with coordinates plotted on
# x-axis and y-axis.
import numpy as np
import matplotlib.pyplot as plt
from random import randint
points = np.array([
[randint(0, 100) for _ in range(50)],
[randint(0, 100) for _ in range(50)],
])
fig, ax = plt.subplots()
ax.plot(points[0], points[1], 'ro')
plt.show()
1 | # Create 2 arrays, using MatPlotLib, plot the graph with the content of the two arrays, with coordinates plotted on |
2 | # x-axis and y-axis. |
3 | |
4 | import numpy as np |
5 | import matplotlib.pyplot as plt |
6 | from random import randint |
7 | |
8 | points = np.array([ |
9 | [randint(0, 100) for _ in range(50)], |
10 | [randint(0, 100) for _ in range(50)], |
11 | ]) |
12 | |
13 | fig, ax = plt.subplots() |
14 | ax.plot(points[0], points[1], 'ro') |
15 | plt.show() |
16 |