'Netlogo plot of breeds-own variable of multiple turtles

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: enter image description here



Solution 1:[1]

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)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matteo