Reputation: 33
I'm working through a textbook, and trying to plot the way a variable 'energy' changes over time, for two breeds, 'sheep' and 'wolves'.
When I try and plot the energy for wolves, I use the code:
plot [energy] of wolves
in the 'pen update commands' for my plot. When I try to run the model using the go procedure, I get the following error message:
PLOT expected input to be a number but got the list [105.09999999999982 129.59999999999982 112.09999999999982 112.09999999999982 112.09999999999982 108.59999999999982 129.59999999999982 115.59999999999982 108.59999999999982 119.09999999999982] instead.
error while observer running PLOT
called by plot 'Energy over Time' pen 'wolves' update code
called by procedure GO
called by Button 'go'
I'd appreciate it if anyone could tell me what I'm doing wrong, and how to get the plot to model the way the agents own variables change over time.
Upvotes: 1
Views: 728
Reputation: 17678
If you have 5 wolves, then you are asking NetLogo to plot a list of 5 numbers, but it needs a single number to plot (on y axis, and tick/time goes on x axis). You probably want the average energy of wolves. Try plot mean [energy] of wolves
Upvotes: 1