-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
80 lines (71 loc) · 3.1 KB
/
plot.py
File metadata and controls
80 lines (71 loc) · 3.1 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# File names
filenames = [
#'data_impact_predation/greedy_greedy.csv',
#'data_impact_predation/greedy_respectful.csv',
#'data_impact_predation/greedy_social.csv',
#'data_impact_predation/conservative_greedy.csv',
#'data_impact_predation/conservative_respectful.csv',
#'data_impact_predation/conservative_social.csv',
#'data_impact_predation/considerate_greedy.csv',
#'data_impact_predation/considerate_respectful.csv',
#'data_impact_predation/considerate_social.csv',
'data/data_impact_predation/40_wasps_min_dist_15_considerate_respectful.csv',
'data/data_impact_predation/40_wasps_min_dist_15_greedy_respectful.csv',
]
# Read each file and add a scenario label
dataframes = []
for file in filenames:
df = pd.read_csv(file)
df = df[df['timestep'] % 5 == 0] # Filter to keep only rows where timestep is a multiple of 10
df['scenario'] = file.replace('data/data_impact_predation/', '').replace('.csv', '') # Add scenario as a column with simplified names
dataframes.append(df)
# Concatenate all dataframes into one
combined_data = pd.concat(dataframes, ignore_index=True)
plt.figure(figsize=(12, 8))
sns.lineplot(data=combined_data, x='timestep', y='alive_queen1', hue='scenario', style='scenario', markers=False)
plt.title('Number of Alive Bees in Queen Bee Over Time by Scenario')
plt.xlabel('Timestep')
plt.ylabel('Number of Alive Bees in Queen Bee')
plt.legend(title='Scenario')
plt.grid(True)
plt.savefig('plots/plots_impact_predation/num_alive_bees.png')
plt.close()
plt.figure(figsize=(12, 8))
sns.lineplot(data=combined_data, x='timestep', y='dead_queen1', hue='scenario', style='scenario', markers=False)
plt.title('Number of Dead Bees in Queen Bee Over Time by Scenario')
plt.xlabel('Timestep')
plt.ylabel('Number of Dead Bees in Queen Bee')
plt.legend(title='Scenario')
plt.grid(True)
plt.savefig('plots/plots_impact_predation/num_dead_bees.png')
plt.close()
plt.figure(figsize=(12, 8))
sns.lineplot(data=combined_data, x='timestep', y='food_queen1', hue='scenario', style='scenario', markers=False)
plt.title('Food Stored in Queen Bee Over Time by Scenario')
plt.xlabel('Timestep')
plt.ylabel('Food Stored in Queen Bee')
plt.legend(title='Scenario')
plt.grid(True)
plt.savefig('plots/plots_impact_predation/food_stored.png')
plt.close()
plt.figure(figsize=(12, 8))
sns.lineplot(data=combined_data, x='timestep', y='health_queen1', hue='scenario', style='scenario', markers=False)
plt.title('Health of Queen Bee Over Time by Scenario')
plt.xlabel('Timestep')
plt.ylabel('Health of Queen Bee')
plt.legend(title='Scenario')
plt.grid(True)
plt.savefig('plots/plots_impact_predation/health.png')
plt.close()
plt.figure(figsize=(12, 8))
sns.lineplot(data=combined_data, x='timestep', y='presence_queen1', hue='scenario', style='scenario', markers=False)
plt.title('Number of Bees Present in Queen Bee Over Time by Scenario')
plt.xlabel('Timestep')
plt.ylabel('Number of Bees Present in Queen Bee')
plt.legend(title='Scenario')
plt.grid(True)
plt.savefig('plots/plots_impact_predation/num_bees_present.png')
plt.close()