最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

transparent background for Great Tables in python - Stack Overflow

programmeradmin2浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论