DatalogiForAlle / AgentsPy

Agent-based simulation for education in Python
GNU General Public License v3.0
5 stars 0 forks source link

New chart variants for modelling agent states #90

Open JensKanstrupLarsen opened 3 years ago

JensKanstrupLarsen commented 3 years ago

Two new model methods, add_state_graph and add_state_bar_chart, can now be used to create charts that show the distribution of agent states, rather than a model variable.

For example, in the context of epidemic.py, an agent might have an attribute:

agent.infection_state = "normal"   # May be "normal", "infected" or "immune"

Charts that show the state distribution over all agents may be created by using:

model.add_state_graph("infection_state", ["normal","infected","immune"], <line colors>, <min>, <max>)
model.add_state_bar_chart("infection_state", ["normal","infected","immune"], <bar color>)
dybber commented 3 years ago

@JensKanstrupLarsen: Vil du gøre så denne kan merges?