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***)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With