Skip to content
Snippets Groups Projects
Commit 932826e5 authored by Attila Kákay's avatar Attila Kákay
Browse files

Heading required in jupyter notebooks.

parent 60bee15b
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:acaf9bb4 tags:
# This a heading in a markdown cell of the notebook
This is text in a markdown cell of the notebook. This is simple a notebook to test the notebook visualization in sphinx. To create an example notebook for the documentation:
- create a notebook, this example is called 'test_notebook.ipynb'
- IMPORTANT: all notebooks needs to have a heading like '# Something'
- execute all cells of the notebook in order (for proper numbering of in and output)
- save the notebook to docs/examples/
- link the example in 'docs/examples.rst' like follows
%% Cell type:raw id:8aa42f15 tags:
.. toctree::
:maxdepth: 4
:caption: Examples:
Test example <examples/test_notebook.ipynb>
%% Cell type:markdown id:9d0bc5d2 tags:
Now comes the example
%% Cell type:code id:8f3404a3 tags:
``` python
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
```
%% Cell type:markdown id:22b7090c tags:
We will just do some stuff here inbetween, and explain things.
%% Cell type:code id:89f751d9 tags:
``` python
def my_function(A, x):
return A*np.sin(x)
```
%% Cell type:markdown id:4f3f122d tags:
Now we will calculate some stuff and plot it.
%% Cell type:code id:61b571c9 tags:
``` python
A = 2
x_ = np.linspace(0, 10,100)
y_ = my_function(A, x_)
print(y_)
```
%% Output
[ 0. 0.20167684 0.40129771 0.59682761 0.78627322 0.96770328
1.13926821 1.29921903 1.44592512 1.57789093 1.69377113 1.7923844
1.87272545 1.93397525 1.97550938 1.99690445 1.99794234 1.97861247
1.9391119 1.8798433 1.80141089 1.70461424 1.59044011 1.46005246
1.31478049 1.15610517 0.98564409 0.80513498 0.61641803 0.4214171
0.22212008 0.02055868 -0.18121229 -0.38113593 -0.57717412 -0.76732838
-0.94966022 -1.12231087 -1.28352028 -1.431645 -1.56517501 -1.68274904
-1.78316851 -1.86540971 -1.92863423 -1.97219755 -1.99565556 -1.99876912
-1.98150649 -1.94404365 -1.88676252 -1.81024703 -1.71527722 -1.60282124
-1.47402552 -1.33020303 -1.17281996 -1.00348074 -0.82391166 -0.63594333
-0.44149195 -0.24253984 -0.04111519 0.1607286 0.36093386 0.55745964
0.74830246 0.93151681 1.10523494 1.2676859 1.4172136 1.5522937
1.67154914 1.7737642 1.85789686 1.92308943 1.96867732 1.99419578
1.99938468 1.98419112 1.94876998 1.89348236 1.81889189 1.72575896
1.61503301 1.48784282 1.34548501 1.18941083 1.02121136 0.84260128
0.65540142 0.46152015 0.26293398 0.06166736 -0.14022792 -0.34069366
-0.53768625 -0.72919747 -0.91327498 -1.08804222]
%% Cell type:code id:25252b06 tags:
``` python
plt.plot(x_, y_)
plt.xlabel("x")
plt.ylabel("y")
plt.show()
```
%% Output
......
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