Files
nn/plot.ipynb
T
2026-03-19 13:47:14 +08:00

208 KiB

In [4]:
import matplotlib
import numpy as np

print(matplotlib.__version__)
3.10.8
In [5]:
from matplotlib import pyplot as plt
In [6]:
xpoints = np.array([0,6])
ypoints = np.array([0,100])
In [7]:
plt.plot(xpoints,ypoints)
Out [7]:
[<matplotlib.lines.Line2D at 0x7f670479bcb0>]
In [8]:
xpoints = np.array([1, 8])
ypoints = np.array([3, 10])

plt.plot(xpoints, ypoints)
plt.show()
In [9]:
xpoints = np.array([1, 8])
ypoints = np.array([3, 10])

plt.plot(xpoints, ypoints, 'o')
plt.show()
In [10]:
xpoints = np.array([1, 2, 6, 8])
ypoints = np.array([3, 8, 1, 10])

plt.plot(xpoints, ypoints)
plt.show()
In [11]:
ypoints = np.array([3, 10])

plt.plot(ypoints)
plt.show()
In [12]:
x = np.arange(0,4*np.pi,0.1)   # start,stop,step
y = np.sin(x)
z = np.cos(x)
plt.plot(x,y,x,z)
plt.show()
In [13]:
x = np.array([1, 2, 3, 4])
y = np.array([1, 4, 9, 16])
plt.plot(x, y)

plt.xlabel("x - label")
plt.ylabel("y - label")
Out [13]:
Text(0, 0.5, 'y - label')
In [16]:
x = np.array([1, 2, 3, 4])
y = np.array([1, 4, 9, 16])
plt.plot(x, y)

plt.title("tittle")
plt.xlabel("x - label")
plt.ylabel("y - label")

plt.show()
In [ ]: