NetLogo: histogram relative frequency

2019-09-03 03:45发布

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条回答
闹够了就滚
2楼-- · 2019-09-03 04:09

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]
查看更多
登录 后发表回答