-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathcmd_plot.py
47 lines (35 loc) · 861 Bytes
/
cmd_plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import plotext
import numpy as np
'''X = np.random.random(100)
y = np.random.random(100)
plotext.scatter(X,y)
plotext.title("Random Data Points")
plotext.show()
plotext.clear_plot()
y = plotext.sin()
plotext.plot(y)
plotext.title("SIN")
plotext.show()
---------------------------------------
X = np.arange(0, 10, 0.1)
y = np.sin(X)
y2 = np.cos(X)
plotext.plot(X, y, label="Sin")
plotext.plot(X, y2, label="Cos")
plotext.title("Sin & Cos")
plotext.show()'''
############## sin function animation on cmd ################
l = 1000
x = range(1, l+1)
frames = 50
plotext.title("Sine Animation")
plotext.clc()
for i in range(frames):
plotext.clt()
plotext.cld()
y = plotext.sin(1, 4, l, 2 * i / frames)
plotext.xlim(0, 400)
plotext.plot(x, y, marker="dot", color="red")
plotext.sleep(0.001)
plotext.show()
plotext.clear_plot()