Libraries‎ > ‎Library‎ > ‎Layout‎ > ‎

Layout grid

BehaviourComposer: ignore everything before this.
Begin micro-behaviour:
Begin description:Place a set of agents in a rectangular grid.End description

Grid layout

Begin NetLogo code:
substitute-text-area-for upper-left-x min-pxcorsubstitute-text-area-for upper-left-y min-pycorsubstitute-text-area-for grid-width world-widthsubstitute-text-area-for grid-height world-heightsubstitute-text-area-for agents-to-lay-out-in-a-grid all-individuals                layout-grid   agents-to-lay-out-in-a-grid  upper-left-x  ; upper left x  upper-left-y  ; upper left y  grid-width    ; width  grid-height   ; height
End NetLogo code

Variants

To change the location of the grid of agents change the upper left x and y. To make a grid of a different size edit the width and height. If you want separate rectangles for different kinds of agents, e.g. "Sheep" then fill the first text area with all-of-kind "Sheep".

How this works

This uses the Modelling4All NetLogo layout-grid command to place the agents in a rectangle.

Related micro-behaviours

The three-dimensional version of this is Lay out rectangular prism.

Other layouts are supported by Lay out circle and Lay out linked agents.

History

Grid layout was implemented by Ken Kahn on 10 November 2009.

BehaviourComposer: ignore everything after this.