Skip to content
Snippets Groups Projects
Commit e728b11c authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Use Agg backend for mpl in CI

Add matplotlib.use('Agg') to the code examples, which is necessary when run in
an environment without X11 sever, such as the CI pipeline.
parent aa7f789e
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -98,7 +98,7 @@ Numpy arrays overload the typical arithmetic operations, such that the above
statement benefits from numpys efficient, vectorized (i.e. performing the same
operation on may values) implementation. You should always think about a way to
use such vectorized statements, and try to avoid manually looping over all the
values. Using a python loop to run over 10^3 values is probably fine, but you
values. Using a python loop to run over $`10^3`$ values is probably fine, but you
don't want to wait for a python loop iterating over 10^6 or 10^9 values.
Finally add a print statement to check that all the caluclations are as expected.
......@@ -127,11 +127,19 @@ the cropped parabola f(x), which is limited y=4 for x>=2.
```math
f(x) = \left\{\begin{array}{lr}
x^2, & \text{for } x < 2\\
4, & \text{for } 2 \leq x\\
\end{array}\right\} = xy
4, & \text{for } 2 \leq x
\end{array}\right\.
```
Create the file `func_plot.py` and add the following lines.
<!-- Add additional files for non-X11 environment in CI -->
<!-- write func_plot.py
```python
import matplotlib
matplotlib.use('Agg')
```
-->
<!-- write func_plot.py -->
```python
import numpy as np
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment