Skip to contents

A pie chart with population counts, split by species and epigentic state. It also provides annotations for the simulation data.

Usage

plot_state(simulation, color_map = NULL)

Arguments

simulation

A simulation.

color_map

A named vector representing the simulation species color map (optional).

Value

A ggplot plot.

Examples

sim <- SpatialSimulation()
sim$add_mutant(name = "A",
               epigenetic_rates = c("+-" = 0.01, "-+" = 0.02),
               growth_rates = c("+" = 0.2, "-" = 0.08),
               death_rates = c("+" = 0.1, "-" = 0.01))
sim$place_cell("A+", 500, 500)
sim$run_up_to_time(60)
#> 
 [█████████████████████-------------------] 50% [00m:00s] Saving snapshot                                         

 [█████████████████████-------------------] 50% [00m:00s] Cells: 0                                                

 [█████████████████████-------------------] 50% [00m:00s] Cells: 0                                                

 [█████████████████████-------------------] 50% [00m:00s] Cells: 0                                                


plot_state(sim)


# define a custom color map
color_map <- c("#B2DF8A", "#E31A1C")
names(color_map) <- c("A+", "A-")

plot_state(sim, color_map=color_map)