-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw_preys.py
More file actions
45 lines (39 loc) · 879 Bytes
/
draw_preys.py
File metadata and controls
45 lines (39 loc) · 879 Bytes
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
import numpy as np
import matplotlib.pyplot as plt
years = 501
eaten = np.loadtxt(f'./data/eaten-{years}.txt')
cow = eaten[:,0]
sheep = eaten[:,1]
print(cow.shape)
print(sheep.shape)
# kg/只
MASS = [
[753, 87.5, 3.94625],
[0, 0, 0],
[0, 0, 0]
]
# calorie/kg
# 所有能量都按照 million 计算
ENERGY_PER_MASS = np.array([
[1250000, 1180000, 1020000],
[0, 0, 0],
[0, 0, 0]
]) / 1e6
# 只/km^2
DENSITY = [
[3.4130, 9.4514, 0],
[0, 0, 0],
[0, 0, 0]
]
fig, axes = plt.subplots(
nrows=1, ncols=1,
figsize=(12, 8)
)
axes.set_xlabel('Age/year')
axes.set_ylabel('Number of preys')
axes.set_title('Preys eaten changes with time')
axes.plot(np.arange(0, years), eaten[:,0], label='Cow')
axes.plot(np.arange(0, years), eaten[:,1], label='Sheep')
axes.legend()
import save_fig as sf
sf.save_to_file(f'Number of prey intake-age={years}')