Skip to contents

Plots cells distribution over a tissue highlighting species by color. To facilitate the plot and avoid excessive number of cells, for instance, when a simulation deals with millions of cells, the plot draws a hexagonal heatmap of 2D bins.

Usage

plot_tissue(simulation, num_of_bins = 100)

Arguments

simulation

A simulation object.

num_of_bins

The number of bins (optional, default: 100).

Value

An editable ggplot plot.

Examples

sim <- SpatialSimulation()
sim$add_mutant(name = "A",
               epigenetic_rates = c("+-" = 0.01, "-+" = 0.01),
               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)
#> 
 [██████████████--------------------------] 34% [00m:00s] Saving snapshot                                     

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

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

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

plot_tissue(sim)
#> Warning: No shared levels found between `names(values)` of the manual scale and the data's fill values.