| 1 |
--- |
| 2 |
jupyter: |
| 3 |
kernelspec: |
| 4 |
display_name: Python 2 |
| 5 |
language: python |
| 6 |
name: python2 |
| 7 |
nbformat: 4 |
| 8 |
nbformat_minor: 2 |
| 9 |
--- |
| 10 |
|
| 11 |
::: {.cell .markdown} |
| 12 |
# A notebook with R cells |
| 13 |
|
| 14 |
This notebook shows the use of R cells to generate plots |
| 15 |
::: |
| 16 |
|
| 17 |
::: {#cell-1 .cell .code} |
| 18 |
``` python |
| 19 |
%load_ext rpy2.ipython |
| 20 |
``` |
| 21 |
::: |
| 22 |
|
| 23 |
::: {#cell-2 .cell .code} |
| 24 |
``` python |
| 25 |
%%R |
| 26 |
suppressMessages(require(tidyverse)) |
| 27 |
``` |
| 28 |
::: |
| 29 |
|
| 30 |
::: {#cell-3 .cell .code} |
| 31 |
``` python |
| 32 |
%%R |
| 33 |
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() |
| 34 |
``` |
| 35 |
::: |
| 36 |
|
| 37 |
::: {.cell .markdown} |
| 38 |
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 |
| 39 |
::: |
| 40 |
|
| 41 |
::: {#cell-4 .cell .code} |
| 42 |
``` python |
| 43 |
%%R -w 400 -h 240 |
| 44 |
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() |
| 45 |
``` |
| 46 |
::: |