mirror of
https://github.com/TeachBooks/template.git
synced 2026-11-12 22:25:52 +00:00
12 lines
No EOL
228 B
Python
12 lines
No EOL
228 B
Python
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
|
|
x = np.linspace(0, 2*np.pi, endpoint=True)
|
|
y = np.cos(x)
|
|
|
|
plt.figure()
|
|
plt.plot(x, y)
|
|
plt.title('$y=\cos(x)$')
|
|
plt.xlabel('$x$')
|
|
plt.ylabel('$y$')
|
|
plt.savefig('cosinewave.svg') |