Assigning Meaningful Colors to Turtles

By default, NetLogo creates turtles with random colors, and to get rid of it, I normally assign a single color upon calling the create-turtles command. But with my previous project, I used colors to indicate range of values for a specific turtle variable.

In the image above, turtles represent a single household. Each household has the following attributes: education qualification score (education), poverty status (poverty) and its access to electricity (electricity). The household's access to electricity is calculated based on a specified probability estimate formula. The color of the household is then defined by using the scale-color command.
create households 1 [
  ......
  ......
  ......
  set electricity ........
  set color scale-color red electricity 0.0 0.9
]

With that improved definition for the color variable, the shade of a household's color is proportional to the value of the electricity variable.

Here's another way to assign meaningful colors to turtles:

create-ordered-turtles [
      set type one-of [0 1 2]
      set color item type [55 115 125]
]

I used the type variable to indicate if it's a family member (type = 0), guest (type = 1)or sponsor (type = 2).



Share on Google Plus

About SSabal

:)
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment