Netlogo:如何计算具有特定颜色的海龟的数量并将它们绘制在 Y 轴上
Netlogo: How to count the number of turtles with specific color and plot them on the Y axis
我想计算具有特定颜色(红色)的海龟的数量并将它们绘制在 Y 轴上(X 轴是刻度)。下面是示例程序,3D。感谢您的配合。
3D image
if (variety = 1)
[
set-current-plot "Color-Time"
set-current-plot-pen "CT"
]
plotxy ticks (***add it here***)
这应该有效:
plotxy ticks count turtles with [color = red]
或者,如果您总是绘制每个刻度(包括刻度 0),只需:
plot count turtles with [color = red]
请注意,如果您将绘图代码放在绘图本身内,而不是放在“代码”选项卡中,那么您根本不需要 set-current-plot
和 set-current-plot-pen
。在 NetLogo 中绘图的正常方法是将代码放入绘图中,然后在代码选项卡中使用 reset-ticks
和 tick
自动触发该代码。
我想计算具有特定颜色(红色)的海龟的数量并将它们绘制在 Y 轴上(X 轴是刻度)。下面是示例程序,3D。感谢您的配合。
3D image
if (variety = 1)
[
set-current-plot "Color-Time"
set-current-plot-pen "CT"
]
plotxy ticks (***add it here***)
这应该有效:
plotxy ticks count turtles with [color = red]
或者,如果您总是绘制每个刻度(包括刻度 0),只需:
plot count turtles with [color = red]
请注意,如果您将绘图代码放在绘图本身内,而不是放在“代码”选项卡中,那么您根本不需要 set-current-plot
和 set-current-plot-pen
。在 NetLogo 中绘图的正常方法是将代码放入绘图中,然后在代码选项卡中使用 reset-ticks
和 tick
自动触发该代码。