Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netlogo: How to count the number of turtles with specific color and plot them on the Y axis

I want to count the number of turtles with specific color (Red) and plot them on the Y axis (the X axis is ticks). The following is the sample program, and 3D. We thank you for your cooperation.

3D image

if (variety = 1)
[
 set-current-plot "Color-Time"
 set-current-plot-pen "CT"
]
plotxy ticks (***add it here***)
like image 660
goodgest Avatar asked Nov 07 '25 10:11

goodgest


1 Answers

This should work:

plotxy ticks count turtles with [color = red]

Or, if you're always plotting every tick (including tick 0), just:

plot count turtles with [color = red]

Note that if you put the plotting code inside the plot itself, rather than in the Code tab, then you don't need set-current-plot and set-current-plot-pen at all. The normal way of doing plotting in NetLogo is to put code in plots, then that code is automatically triggered by using reset-ticks and tick in the Code tab.

like image 134
Seth Tisue Avatar answered Nov 11 '25 10:11

Seth Tisue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!