admin管理员组文章数量:1391757
I would like to make the background of the table transparent but am not able to do so. I've tried using hex codes, rgb, and literal colour labels.
I tried tweaking using .tab_style and also .tab_options.
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"
)
)
I have attached a failed output of the table.
本文标签: transparent background for Great Tables in pythonStack Overflow
版权声明:本文标题:transparent background for Great Tables in python - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744771609a2624372.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论