superiorlooki.blogg.se

Netlogo colors
Netlogo colors









netlogo colors
  1. #Netlogo colors how to
  2. #Netlogo colors Patch
  3. #Netlogo colors free

#Netlogo colors Patch

In order to transfer the spatial information from NetLogo to R, we measure the who number, coordinates and breed for all turtles (metrics.turtles) and coordinates, patch color, amount of chemicals, presence of food and the food source number of all patches (metrics.patches).Īfter converting the spatial data to tibble format ( unnest_simoutput()), we split the patches information in three objects in order to display the three groups of patches: Displaying the patches output from the model is not straightforward because three different groups of patches exist: food sources, ants nest and all other patches which are colored depending on the amount of chemicals that the patch contains. These chemicals also diffuse to neighboring cells over time. Ants carrying food leave a trail of chemicals on cells they move over. Ants move across the lattice in order to gather food from food sources and returning food to their nest in the center.

netlogo colors

The Ants model is another typical example for displaying patches and moving turtles.

netlogo colors

# Step1: Create a nl obejct: nl % dplyr :: filter ( breed = "embers" & agent = "turtles" & `` % dplyr :: select ( pxcor, pycor, ``, color, who ) fires % dplyr :: filter ( breed = "fires" & agent = "turtles" & `` % dplyr :: select ( pxcor, pycor, ``, color, who ) patches % dplyr :: filter ( agent = "patches" & `` % dplyr :: select ( pxcor, pycor, pcolor, `` ) # make same space in the memory rm ( nl ) rm ( results ) rm ( nl_spatial ) gc ( ) #- # Plot animation: p1 <- ggplot ( embers ) + geom_tile (data = patches, aes (x = pxcor, y = pycor, fill = factor ( pcolor ) ) ) + geom_point (data = embers, aes (x = pxcor, y = pycor, color = color, group = who ), size = 2 ) + scale_color_gradientn (colors = rev ( cartography :: carto.pal ( "orange.pal", n1 = 8 ) ) ) + geom_point (data = fires, aes (x = pxcor, y = pycor, color = color, group = who ), size = 3 ) + scale_fill_manual (values = c ( "0" = "gray24", "55" = "#83B37D", "11.4" = "#B59A89" ) ) + transition_time ( `` ) + guides (fill = "none", color = "none" ) + coord_equal ( ) + theme_void ( ) g1 <- gganimate :: animate ( p1, nframes = n, width = 800, height = 800, duration = 6 ) # Step1: Create a nl obejct: nl % dplyr :: filter ( agent = "turtles" & `` % dplyr :: select ( xcor, ycor, ``, who ) patches % dplyr :: filter ( agent = "patches" & `` % dplyr :: select ( pxcor, pycor, pcolor, `` ) # Plot animation: p1 <- ggplot ( ) + geom_tile (data = patches, aes (x = pxcor, y = pycor, fill = pcolor ) ) + geom_point (data = turtles, aes (x = xcor, y = ycor, group = who ), size = 2 ) + scale_fill_carto_c (palette = "Prism" ) + transition_time ( `` ) + guides (fill = "none", color = "none" ) + coord_equal ( ) + theme_void ( ) gganimate :: animate ( p1, nframes = n, width = 800, height = 800, duration = 6 )

#Netlogo colors free

If you have problems to interface a specific type of model, feel free to send one of the authors of nlrx an email!įirst, we need to load a bunch of packages, mainly for the subsetting of the spatial data and the plotting: Although, the following examples cover a wide range of output types, it is likely that different experiment measurements or postprocessing needs to be done for specific and complex models.

#Netlogo colors how to

We explicitly show how to setup, postprocess and plot spatial output for very different model types. Our examples show how spatial output from NetLogo models can be used to create animated gif files, displaying patches and turtles properties over time. With our interfacing examples, we try to cover a wide range of different models to show how nlrx can be utilized for various applications. NetLogo model interfaces are very diverse across models and might contain spatial elements of different types (patches, different groups of turtles, links). Here, we present examples on how to interface a variety of different NetLogo models.











Netlogo colors