# Simulation time series plotting and analysis¶

Author: Lukas Breitwieser
In this tutorial we show how to collect data during the simulation, and plot and analyse it at the end.
To this extent, we create a simulation where cells divide rapidly leading to exponential growth.

Let's start by setting up BioDynaMo notebooks.

Let's create a behavior which divides cells with $5\%$ probability in each time step.
New cells should also get this behavior.
Therefore, we have to call AlwaysCopyToNew().
Otherwise, we would only see linear growth.

Let's create a function that creates a cell at a specific position, with diameter = 10, and the rapid_division behavior.

As starting condition we want to create 100 cells randomly distributed in a cube with $min = 0, max = 200$

Before we start the simulation, we have to tell BioDynaMo which data to collect.
We can do this with the TimeSeries::AddCollector function.
In this example we are interested in the number of agents ...

... and the number agents with $diameter < 5$.
We create a condition cond and pass it to the function Count which returns the number of agents for which cond(agent) evaluates to true.

Now let's simulate 40 iterations

Now we can plot how the number of agents (in this case cells) and the number of agents with $diameter < 5$ evolved over time.