问题
I'm still having problems with [histogram]
.
I have a global variable (age-sick) that stores the age of the turtles when they got sick...and I want to plot the distribution: histogram age-sick
However I do not want the absolute number of turtles who got sick per every age, rather the relative one. Is there a way to do so?
回答1:
I have tried to overcome the problem in the following way:
let age-freq (list)
let i 0
while [ i <= (max age-sick)] [
let a filter [? = i] age-sick
repeat (length a / length age-sick * 1000) [set age-freq lput i age-freq]
set i i + 1]
histogram age-freq]
来源:https://stackoverflow.com/questions/37051972/netlogo-histogram-relative-frequency