Reputation: 91
I'm busy trying to plot the number of children (turtle breed 1) treated by an organisation (turtle breed 2). The organisations have a turtles-own variable called children-treated
where all the children are stored which are being treated.
In the 'plot update commands' I now have:
ask organizations [
create-temporary-plot-pen (word who)
set-plot-pen-color color
plot [length children-treated]
]
However, an error message says
Expected a number here, rather than a list or block
It is not clear to me to which place this error applies.
It is necessary to make this automatic, and not manually the different plot pens, as the number of organisations can be adjusted by a slider.
This is how I want the plot to look like:
Upvotes: 0
Views: 249
Reputation: 2926
As you can see here, the syntax for plot
is plot number, without square brackets (that in NetLogo identify a list or a block of commands). Your length children-treated
is a number (so I understand that children-treated
is a list), so you don't need to enclose it in square brackets:
plot length children-treated
At most you can use parentheses for the purpose of readability:
plot (length children-treated)
Upvotes: 1