Skip to content

TeX Improvements #1

@has2k1

Description

@has2k1

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

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

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}$")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions