Yes, a similar question has been asked here NetLogo: histogram relative frequency, but as far as I know, no answer has been given. Am I allowed to re-ask it again? I would have added a comment under the question but I am not allowed to.
I would like to plot the relative frequency of patches with a specific colour against increasing distance from a turtle. What I've tried so far:
ask turtle [
set-current-plot "plot 1"
set-plot-y-range 0 1
set-plot-pen-mode 1
histogram [distance myself] of patches with [pcolor = red]]
This only gives me the absolute frequency. I want to plot the relative frequency of each patch colour against increasing distance from a turtle. So at distance = 1 away from turtle, how many patches out of the total no. of patches are red. I tried adding a
histogram [distance myself ] of patches with [ ] / count patches with [distance myself = 1] ; when x-axis = 1, and so for increasing x
but there were certain syntax problems since the primitive histogram expects a list. I would think there is a simpler way to set the y-axis to (absolute occurrences/total no. of patches at distance x) so I looked through the Netlogo dictionary but could not find something that sets up the y-axis under plot set-up commands.
Would appreciate any advice with regards to this issue! Thank you for your time.