jeroenjanssens / jeroenjanssens/r4ds-python-plotnine

TeX Improvements

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
23
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Thank you for creating this extensive tutorial. A few improvements on using TeX:

1. All you need to do is wrap the text with `$`.
2. You can avoid the double escaping by using raw strings i.e `r'string'`.

So this chunk

```python
from matplotlib import rc
rc('text', usetex=True)

df = pd.DataFrame({"x": np.random.uniform(size=10),
"y": np.random.uniform(size=10)})

ggplot(df, aes("x", "y")) +\
geom_point() +\
labs(x="$\\sum_{i = 1}^n{x_i^2}$",
y="$\\alpha + \\beta + \\frac{\\delta}{\\theta}$")
```

becomes this

```python
df = pd.DataFrame({"x": np.random.uniform(size=10),
"y": np.random.uniform(size=10)})

ggplot(df, aes("x", "y")) +\
geom_point() +\
labs(x=r"$\sum_{i = 1}^n{x_i^2}$",
y=r"$\alpha + \beta + \frac{\delta}{\theta}$")
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.