在netlogo中的特定坐标处设置标签

时间:2016-07-30 09:45:06

标签: netlogo coordinate

如何在netlogo中的特定坐标处设置标签。我试过以下方法

ask people
    [setxy -16 15 ;Defining Positions  
     set label (word (WORD "This is: John " ))   
     set label-color white]  

人是我的乌龟

但是setxy将我的乌龟和标签移动到(-16,15)。我只想将标签移动到这些坐标。乌龟应该留在原处。任何帮助将不胜感激,因为我是Netlogo的新手,并且我正尽力学习这门语言。非常感谢你

1 个答案:

答案 0 :(得分:2)

label附在龟身上。它总是随之移动。

但是,如果您希望标签位于固定位置,则可以使用补丁标签:plabel。例如:

ask patch -16 15 [
  set plabel "This is: John"
  set plabel-color white
]

为了获得更多灵活性,另一种可能性是创建一种虚拟的海龟品种,并将它们专门用于标签:

breed [ signs sign ]

to setup
  clear-all
  create-signs 1 [
    setxy -9.5 13.5
    set size 0 ; hide the turtle, but not the label
    set label "This is: John"
    set label-color white
  ]
end

这样,您可以使用更精确的坐标,并在需要时移动标签。