Skip to content

Latex does not work in labels #861

Closed
@aeturrell

Description

@aeturrell

It would be great if latex worked in figure labels.

Expected behaviour is that the following would produce CO2 with the 2 in subscript (reprex follows):

from pandas_datareader import wb
from letsplot import *

LetsPlot.setup_html()

df = wb.download(
    indicator="EN.ATM.CO2E.PC",
    country=["US", "CHN", "IND", "Z4", "Z7"],
    start=2017,
    end=2017,
)
df = df.reset_index()
df = df.sort_values("EN.ATM.CO2E.PC")

(
    ggplot(df, aes(x="country", y="EN.ATM.CO2E.PC")) +
    geom_bar(aes(fill="country"), alpha=.8, stat="identity") +
    scale_fill_discrete() +
    theme_minimal() +
    theme(legend_position="none") +
    labs(
        subtitle=r"CO$_2$ (metric tons per capita)",
        title="The USA leads the world on per-capita emissions"
    )
)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions