by Anonymous » 12 Mar 2025, 03:52
Ich möchte den Hintergrund der Tabelle transparent machen, aber ich kann dies nicht tun.
Code: Select all
import polars as pl
import polars.selectors as cs
from great_tables import GT, md, html, style, loc
from great_tables.data import airquality
airquality_mini = airquality.head(20).assign(Year = 1973)
pl_airquality = pl.DataFrame(airquality_mini).select(
"Year", "Month", "Day", "Ozone", "Solar_R", "Wind", "Temp"
)
gt_air = GT(pl_airquality)
(
gt_air
.tab_style(
style=
[
style.fill(color="rgba(0, 0, 0, 0)"),
style.text(font="Arial")
],
locations=
[
loc.subtitle(),
loc.title()
]
)
.tab_header(
title = md("**New York Air Quality Measurements**"),
subtitle = "Daily measurements in New York City (May 1-10, 1973)"
)
.opt_table_font(font=["Corbel"])
# Table styles ----
.tab_style(
style.fill("lightyellow"),
loc.body(
columns = cs.all(),
rows = pl.col("Wind") == pl.col("Wind").max()
)
)
.tab_style(
style.text(weight = "bold"),
loc.body("Wind", pl.col("Wind") == pl.col("Wind").max())
)
.save(
file = "tweakable.png",
scale = 1.0,
web_driver = "chrome"
)
)
Ich habe eine fehlgeschlagene Ausgabe der Tabelle angehängt.>
[url=viewtopic.php?t=14917]Ich möchte[/url] den Hintergrund der Tabelle transparent machen, aber ich kann dies nicht tun.[code]import polars as pl
import polars.selectors as cs
from great_tables import GT, md, html, style, loc
from great_tables.data import airquality
airquality_mini = airquality.head(20).assign(Year = 1973)
pl_airquality = pl.DataFrame(airquality_mini).select(
"Year", "Month", "Day", "Ozone", "Solar_R", "Wind", "Temp"
)
gt_air = GT(pl_airquality)
(
gt_air
.tab_style(
style=
[
style.fill(color="rgba(0, 0, 0, 0)"),
style.text(font="Arial")
],
locations=
[
loc.subtitle(),
loc.title()
]
)
.tab_header(
title = md("**New York Air Quality Measurements**"),
subtitle = "Daily measurements in New York City (May 1-10, 1973)"
)
.opt_table_font(font=["Corbel"])
# Table styles ----
.tab_style(
style.fill("lightyellow"),
loc.body(
columns = cs.all(),
rows = pl.col("Wind") == pl.col("Wind").max()
)
)
.tab_style(
style.text(weight = "bold"),
loc.body("Wind", pl.col("Wind") == pl.col("Wind").max())
)
.save(
file = "tweakable.png",
scale = 1.0,
web_driver = "chrome"
)
)
[/code]
Ich habe eine fehlgeschlagene Ausgabe der Tabelle angehängt.>