For some phenomena, modeling the way agents look is almost as important as modeling how they behave. For others, creating pleasing and creative visualizations may simply augment our enjoyment of the modeling process and help us communicate our ideas better with others.
NetLogo includes a Turtle Shapes Editor, a Link Shapes editor, and a Color Swatches panel that allow us to create agent-based models that do not only represent real-world phenomena conceptually, but also create powerful visualizations of our agents. If you would like to learn more about how to use the shapes editors and the color swatches, read along.
Note: You can visit the NetLogo User Manual at https://ccl.northwestern.edu/netlogo/docs/ for more information on Shapes and Colors*
In NetLogo, turtle shapes are vector shapes. They are built up from basic geometric shapes; squares, circles, and lines, rather than a grid of pixels. This way, when we resize a turtle, its image does not loose quality (i.e., does not become pixelated).
NetLogo already has a lot of pre-designed shapes for us to use. Some of these shapes, called default shapes are embedded within each new NetLogo model. These shapes are:
And the names of these shapes are:
NetLogo has way more turtle shapes than the default ones for us to choose from. All we need to do is to click the Import From Library button, which will bring up a long list of shapes to choose from.
If none of the shapes in the library fits our model, we can create new shapes from scratch by clicking the New button and drawing our own shape.
A few things to keep in mind while using the New Shape Editor:
set
and color
primitives. This color is gray by default.
For more detailed information, visit the Shapes Editor section of the NetLogo User Manual at https://ccl.northwestern.edu/netlogo/docs/shapes.html.
NetLogo has a custom way of representing colors that makes it easier to remember how to use them in code and how to manipulate color. Each color is assigned a number in the range 0 to 140, with the exception of 140 itself. The best way to familiarize ourselves with NetLogo colors is to click the Tools menu and pick the Color Swatches option, which will bring up a window that contains an interactive version of the following image that shows the corresponding number for each color and it's shades:
Things to keep in mind while using NetLogo colors in code:
set color green
or set color violet
.set color green + 1
or set color yellow - 2
. As a rule of thumb, if you add to a color, you will get a lighther shade, and if you deduct from a color, you will get a darker shade.set color green + 2.735
or set color yellow - 3.336
.approximate-rgb
and approximate-hsb
primitives to get a specific color shade.
For more detailed information, visit the Colors section of the NetLogo User Manual's Programming Guide Section at at https://ccl.northwestern.edu/netlogo/docs/programming.html#colors.
NetLogo also allows us to go beyond the simple straight lines and define a variety of custom link shapes for our models. To create new link shapes, click the Tools menu and click the Link Shapes Editor item. You will
In contrast to turtle shapes, NetLogo only has one standard link shape and there is no library, either. If we want to use a link shape other than straight line, we either need to create it from scratch by clicking the New button or import it from a previously developed model by clicking the Import from Model button.
Things to keep in mind while using the Link Shapes Editor:
thickness
primitive in your code to change a link's thickness such as ask links [ set thickness 4 ]
.
For more detailed information, visit the Shapes Editor section of the NetLogo User Manual at https://ccl.northwestern.edu/netlogo/docs/shapes.html#creating-and-editing-link-shapes.