# 6. Phenotype Phase PlaneΒΆ

Phenotype phase planes will show distinct phases of optimal growth with different use of two different substrates. For more information, see Edwards et al.

Cobrapy supports calculating and plotting (using
matplotlib) these phenotype phase planes.
Here, we will make one for the “textbook” *E. coli* core model.

```
In [1]:
```

```
%matplotlib inline
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
from time import time
import cobra.test
from cobra.flux_analysis import calculate_phenotype_phase_plane
model = cobra.test.create_test_model("textbook")
```

We want to make a phenotype phase plane to evaluate uptakes of Glucose and Oxygen.

```
In [2]:
```

```
data = calculate_phenotype_phase_plane(
model, "EX_glc__D_e", "EX_o2_e")
data.plot_matplotlib();
```

If palettable is installed, other color schemes can be used as well

```
In [3]:
```

```
data.plot_matplotlib("Pastel1")
data.plot_matplotlib("Dark2");
```

The number of points which are plotted in each dimension can also be changed

```
In [4]:
```

```
data = calculate_phenotype_phase_plane(
model, "EX_glc__D_e", "EX_o2_e",
reaction1_npoints=20, reaction2_npoints=20)
data.plot_matplotlib();
```

The code can also use multiple processes to speed up calculations

```
In [5]:
```

```
start_time = time()
calculate_phenotype_phase_plane(
model, "EX_glc__D_e", "EX_o2_e",
reaction1_npoints=100, reaction2_npoints=100,
n_processes=1)
print("took %.2f seconds with 1 process" % (time() - start_time))
start_time = time()
calculate_phenotype_phase_plane(
model, "EX_glc__D_e", "EX_o2_e",
reaction1_npoints=100, reaction2_npoints=100,
n_processes=4)
print("took %.2f seconds with 4 process" % (time() - start_time))
```

```
took 0.44 seconds with 1 process
took 0.25 seconds with 4 process
```