1

I've a simple problem.

In my code there are some patches that contain food. I computed the # of visits for each one of these "resources". Now I want to put in a histogram the # of visits for each one of these "resource-patches" .

If I write in the GUI:

histogram [visits] of resource-patches

It plots me something strange.

This is because, usually, you put the "x" values in the brackets [ ] of the patches-own attribute. Instead, I want that

-in the "x-axis" there are the labels (for example) of the resource-patches (or their amount of food) whereas

-in "y-axis" I want the #of visits for each one of the resource-patches.

I'm struggling since yesterday but I can't find a solution.

Thank you in advance guys!

1 Answers1

2

A histogram only takes in the values for the x-axis. The y-axis will always be the number of occurrences of x in the list provided. For you, it'll plot the frequency of each of yours visits.

If your visits list is [1 1 3 5 2 3 4 5]

You'll see a histogram of

x, y
1->2
2->1
3->1
4->1
5->2

I think you may want to look at another plotting tool if this is not what you want.

mattsap
  • 3,790
  • 1
  • 15
  • 36
  • yeah sounds like you want something more like `ask resources-patches [ plot visits ]` – Seth Tisue Feb 29 '16 at 22:17
  • I did it. I thought to create an invisible turtle each time that an agent goes to that resource. Then, I can count the number of this "marker" turtles on each resource. Thank you anyway – Jane Aminato Mar 01 '16 at 15:27