forked from jeroenjanssens/r4ds-python-plotnine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
57 lines (33 loc) · 2.17 KB
/
README.Rmd
File metadata and controls
57 lines (33 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, echo=FALSE}
library(knitr)
library(reticulate)
use_virtualenv("./venv", required = TRUE)
opts_chunk$set(comment = "")
```
# Plotnine: Grammar of Graphics for Python
##### A translation of the visualisation chapters from "R for Data Science" to Python using Plotnine and Pandas.
This repository contains all the code and text to generate [this tutorial](https://www.datascienceworkshops.com/blog/plotnine-grammar-of-graphics-for-python). The tutorial is also available as a Jupyter notebook and an R notebook; these are located in the *output* directory.
## Run notebooks
To run these notebooks, make sure you have the necessary dependencies installed. After cloning this repository you can:
* Run `make venv` to create a virtualenv with Python 3.7, install the packages listed in *requirements.txt*, and create a Jupyter kernel specification.
* Run `make lab` to start Jupyter Lab using the virtualenv.
* Run `make renv/library` to use to install all the required R packages.
## Re-create notebooks from source
If you change the input source, i.e., *input/r4ds-python-plotnine.ipynb.Rmd*, you can:
* Run `make ipynb` to re-create the Jupyter notebook *output/r4ds-python-plotnine.ipynb*.
* Run `make rmd` to re-create the R notebook *output/r4ds-python-plotnine.Rmd*.
This tutorial and the accompanying code has been written and tested on macOS. I suspect that it also works on other Unix and Linux distributions. I doubt that it works out of the box on Windows. The *Makefile* and *requirements.txt* files may provide useful hints on how to install the dependencies.
## R packages used
```{r}
sessioninfo::session_info()
```
## Python packages used
```{bash}
. venv/bin/activate && pip freeze
```
## License
The tutorial, the Jupyter notebook and the R notebook are licenced, just like the original text, under the [Creative Commons Attribution-NonCommercial-NoDerivs 3.0](https://creativecommons.org/licenses/by-nc-nd/4.0/) License while everything else is licensed under the [MIT License](https://raw.githubusercontent.com/datascienceworkshops/r4ds-python-plotnine/master/LICENSE).