Row styles are not applied to rowname_col when rowname_col is specified
I am trying to create a line that runs across the top of the last row of my table (to separate the "Total" row from the rest of the table). This works great using .tab_style, but when I also specify rowname_col, the style is removed from the rowname_col column. I would expect that that the defined tab_style still works regardless of whether rowname_col is specified.
Reproducible example
(adapted from the docs)
With rowname_col
Without rowname_col
import polars as pl
from great_tables import GT, md, html, style, loc
from great_tables.data import islands
islands_mini = (
pl.from_pandas(islands).sort("size", descending=True)
.head(10)
)
(
GT(islands_mini,
rowname_col="name" # Comment out this line to show intended style.
)
.tab_header(
title="Large Landmasses of the World",
subtitle="The top ten largest are presented"
)
.tab_source_note(source_note="Source: The World Almanac and Book of Facts, 1975, page 406.")
.tab_source_note(
source_note=md("Reference: McNeil, D. R. (1977) *Interactive Data Analysis*. Wiley.")
)
.tab_stubhead(label="landmass")
.fmt_integer(columns="size")
.tab_style(
style=style.borders(sides=["top"], style="double", weight="4px"),
locations=loc.body(rows=[-1])
)
)
Development environment
- Operating System: Colab notebook
- great_tables: 479eb732c912cb5062c4d7e61c6b31301787b00c (v0.5.0)
Thanks for raising -- this hits a tricky piece with how we've broken apart table structure. Basically, without rowname_col there is no row stub, just a table body. This means the line crosses the whole table.
With rowname_col specified, there is a row stub. So we need to also tell it to underline that row in the row stub. This should be supported once we complete #170, since it will allow you to use loc.stub() in addition to loc.body() for underlining.
Makes sense, thank you!