Skip to content

Commit

Permalink
Mirror files updated (outputs removed, metadata filtered)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Mar 28, 2019
1 parent b4aa2e7 commit c0a500a
Show file tree
Hide file tree
Showing 18 changed files with 243 additions and 524 deletions.
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
::: {.cell .code execution_count="1"}
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
nbformat: 4
nbformat_minor: 2
---

::: {.cell .code}
``` {.python}
1 + 1
```

::: {.output .execute_result execution_count="1"}
2
:::
:::

::: {.cell .markdown}
A markdown cell And below, the cell for function f has non trivial cell
metadata. And the next cell as well.
A markdown cell
And below, the cell for function f has non trivial cell metadata. And the next cell as well.
:::

::: {.cell .code execution_count="2" attributes="{"n":"10","id":"","classes":[]}"}
::: {.cell .code attributes="{"n":"10","id":"","classes":[]}"}
``` {.python}
def f(x):
return x
```
:::

::: {.cell .code execution_count="3" attributes="{"n":"10","id":"","classes":[]}"}
::: {.cell .code attributes="{"n":"10","id":"","classes":[]}"}
``` {.python}
f(5)
```

::: {.output .execute_result execution_count="3"}
5
:::
:::

::: {.cell .markdown}
More text
:::

::: {.cell .code execution_count="4"}
::: {.cell .code}
``` {.python}
2 + 2
```

::: {.output .execute_result execution_count="4"}
4
:::
:::
Original file line number Diff line number Diff line change
@@ -1,55 +1,45 @@
::: {.cell .code execution_count="1"}
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
nbformat: 4
nbformat_minor: 2
---

::: {.cell .code}
``` {.python}
%%html
<p><a href="https://github.com/mwouts/jupytext", style="color: rgb(0,0,255)">Jupytext</a> on GitHub</p>
```

::: {.output .display_data}
<p><a href="https://github.com/mwouts/jupytext", style="color: rgb(0,0,255)">Jupytext</a> on GitHub</p>
:::
:::

::: {.cell .code execution_count="2"}
::: {.cell .code}
``` {.python}
%%latex
$\frac{\pi}{2}$
```

::: {.output .display_data}
$\frac{\pi}{2}$
:::
:::

::: {.cell .code execution_count="3"}
::: {.cell .code}
``` {.python}
%load_ext rpy2.ipython
```
:::

::: {.cell .code execution_count="4"}
::: {.cell .code}
``` {.python}
%%R
library(ggplot2)
ggplot(data=data.frame(x=c('A', 'B'), y=c(5, 2)), aes(x,weight=y)) + geom_bar()
```

::: {.output .display_data}
![](7f97cecde4f72e650de2f3937ac4999467e76306.png)
:::
:::

::: {.cell .code execution_count="5"}
::: {.cell .code}
``` {.python}
%matplotlib inline
import pandas as pd
pd.Series({'A':5, 'B':2}).plot(figsize=(3,2), kind='bar')
```

::: {.output .execute_result execution_count="5"}
<matplotlib.axes._subplots.AxesSubplot at 0x2da0c41a9e8>
:::

::: {.output .display_data}
![](9344ac2b35133877848c9a89b2fbbcc3dcce81e0.png)
:::
:::
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
nbformat: 4
nbformat_minor: 2
---

::: {.cell .markdown}
##################################################################

This is a notebook that contains many hash signs. Hopefully its python
representation is not recognized as a Sphinx Gallery script\...
This is a notebook that contains many hash signs.
Hopefully its python representation is not recognized as a Sphinx Gallery script\...

##################################################################
:::

::: {.cell .code execution_count="1"}
::: {.cell .code}
``` {.python}
some = 1
code = 2
Expand All @@ -18,17 +28,13 @@ some+code
##################################################################
# Another comment
```

::: {.output .execute_result execution_count="1"}
3
:::
:::

::: {.cell .markdown}
################################################################## {#section}

This is a notebook that contains many hash signs. Hopefully its python
representation is not recognized as a Sphinx Gallery script\...
This is a notebook that contains many hash signs.
Hopefully its python representation is not recognized as a Sphinx Gallery script\...

################################################################## {#section-1}
:::
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
nbformat: 4
nbformat_minor: 2
---

::: {.cell .markdown}
# Part one - various cells
:::
Expand All @@ -9,7 +19,8 @@ with two blank lines
:::

::: {.cell .markdown}
Now we have a markdown cell with a code block inside it
Now we have a markdown cell
with a code block inside it

``` {.python}
1 + 1
Expand All @@ -18,17 +29,13 @@ Now we have a markdown cell with a code block inside it
After that cell we\'ll have a code cell
:::

::: {.cell .code execution_count="1"}
::: {.cell .code}
``` {.python}
2 + 2
3 + 3
```

::: {.output .execute_result execution_count="1"}
6
:::
:::

::: {.cell .markdown}
Expand All @@ -51,14 +58,10 @@ of the raw cell
This is a markdown cell with cell metadata `{"key": "value"}`
:::

::: {.cell .code execution_count="2" .class="null" tags="["parameters"]"}
::: {.cell .code .class="null" tags="["parameters"]"}
``` {.python}
"""This is a code cell with metadata `{"tags":["parameters"], ".class":null}`"""
```

::: {.output .execute_result execution_count="2"}
'This is a code cell with metadata `{"tags":["parameters"], ".class":null}`'
:::
:::

::: {.cell .raw key="value"}
Expand Down
29 changes: 15 additions & 14 deletions tests/notebooks/mirror/ipynb_to_pandoc/Notebook_with_R_magic.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
---
jupyter:
kernelspec:
display_name: Python 2
language: python
name: python2
nbformat: 4
nbformat_minor: 2
---

::: {.cell .markdown}
# A notebook with R cells

This notebook shows the use of R cells to generate plots
:::

::: {.cell .code execution_count="1"}
::: {.cell .code}
``` {.python}
%load_ext rpy2.ipython
```
:::

::: {.cell .code execution_count="2"}
::: {.cell .code}
``` {.python}
%%R
suppressMessages(require(tidyverse))
```
:::

::: {.cell .code execution_count="3"}
::: {.cell .code}
``` {.python}
%%R
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point()
```

::: {.output .display_data}
![](3fc4493185b3637a4127483394ece754faff16c7.png)
:::
:::

::: {.cell .markdown}
The default plot dimensions are not good for us, so we use the -w and -h
parameters in %%R magic to set the plot size
The default plot dimensions are not good for us, so we use the -w and -h parameters in %%R magic to set the plot size
:::

::: {.cell .code execution_count="4"}
::: {.cell .code}
``` {.python}
%%R -w 400 -h 240
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point()
```

::: {.output .display_data}
![](92a00f6aa6af61f269e4b4a9db7fe31d5f8b1dbb.png)
:::
:::
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
::: {.cell .code execution_count="1"}
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
nbformat: 4
nbformat_minor: 2
---

::: {.cell .code}
``` {.python}
%load_ext rpy2.ipython
import pandas as pd
Expand All @@ -14,19 +24,10 @@ df = pd.DataFrame(
```
:::

::: {.cell .code execution_count="2"}
::: {.cell .code}
``` {.python}
%%R -i df
library("ggplot2")
ggplot(data = df) + geom_point(aes(x = X, y = Y, color = Letter, size = Z))
```

::: {.output .stream .stderr}
C:\Users\Marco\AppData\Local\conda\conda\envs\python3\lib\site-packages\rpy2-2.9.4-py3.6-win-amd64.egg\rpy2\robjects\pandas2ri.py:191: FutureWarning: from_items is deprecated. Please use DataFrame.from_dict(dict(items), ...) instead. DataFrame.from_dict(OrderedDict(items)) may be used to preserve the key order.
res = PandasDataFrame.from_items(items)
:::

::: {.output .display_data}
![](7d03ea06cc5a2be89de49cf90faff680e9b93dfa.png)
:::
:::
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
::: {.cell .code execution_count="1" scrolled="false"}
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
nbformat: 4
nbformat_minor: 2
---

::: {.cell .code}
``` {.python}
%%time
print('asdf')
```

::: {.output .stream .stdout}
asdf
CPU times: user 132 µs, sys: 57 µs, total: 189 µs
Wall time: 188 µs
:::
:::

::: {.cell .markdown}
Thanks for jupytext!
:::

::: {.cell .code collapsed="true"}
::: {.cell .code}
``` {.python}
```
:::
16 changes: 11 additions & 5 deletions tests/notebooks/mirror/ipynb_to_pandoc/frozen_cell.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
::: {.cell .code execution_count="1" ExecuteTime="{"start_time":"2018-10-17T10:31:56.157308Z","end_time":"2018-10-17T10:31:56.160823Z"}"}
---
jupyter:
kernelspec:
display_name: Python 3
language: python
name: python3
nbformat: 4
nbformat_minor: 2
---

::: {.cell .code}
``` {.python}
# This is an unfrozen cell. Works as usual.
print("I'm a regular cell so I run and print!")
```

::: {.output .stream .stdout}
I'm a regular cell so I run and print!
:::
:::

::: {.cell .code deletable="false" editable="false" run_control="{"frozen":true}"}
Expand Down
Loading

0 comments on commit c0a500a

Please sign in to comment.