Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs table themes #197

Merged
merged 7 commits into from
Feb 26, 2024
Merged

Docs table themes #197

merged 7 commits into from
Feb 26, 2024

Conversation

machow
Copy link
Collaborator

@machow machow commented Feb 14, 2024

This PR adds a page on table theming options to the Get Started guide. It's still very rough!

https://pr-197--gt-python.netlify.app/get-started/table-theme-options

@github-actions github-actions bot temporarily deployed to pr-197 February 14, 2024 22:42 Destroyed
@github-actions github-actions bot temporarily deployed to pr-197 February 15, 2024 18:53 Destroyed
@github-actions github-actions bot temporarily deployed to pr-197 February 15, 2024 19:03 Destroyed
Many table parts support customizing border colors and style.
This is shown below for column labels.

```{python}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't see the result of setting these options. Is there something else I need to set?!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this instead:

gt_ex.tab_options(
    heading_border_bottom_color="blue",
    heading_border_bottom_style="solid"
)

The reason the other settings may not work is because the shared border (bottom of header, and top of column labels) has a rule where the larger sized part wins.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like, if you use:

gt_ex.tab_options(
    column_labels_border_top_color="blue",
    column_labels_border_top_style="solid",
    column_labels_border_top_width="5px",
)

Then you'll see the blue border because the 5px size is beating out the size of the heading_border_bottom... border.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks! I might use this, and then mention the interaction of borders, if that's okay!


This requires setting a decent number of options, but makes a big difference when presenting a table! Below is a table with a simple, blue theme. (The code is hidden by default, but can be expanded to see all the options set).

```{python}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I essentially derived this from the opt_stylize R code.

@github-actions github-actions bot temporarily deployed to pr-197 February 15, 2024 19:07 Destroyed

## Composite options

TODO: which options are handled in a special way? (e.g. `row_group_as_column = True`)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea which options do a set of things, rather than a single thing? (Or which of those options would be good to illustrate---either here or in their own section).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

container_width and container_height (and container_overflow_x|y) do more complex things which are worth illustrating (especially if space is at a premium for the table on a page).

Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far this is looking good!

@github-actions github-actions bot temporarily deployed to pr-197 February 26, 2024 17:19 Destroyed
Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@machow machow marked this pull request as ready for review February 26, 2024 22:13
@machow machow merged commit 595865d into main Feb 26, 2024
7 checks passed
@rich-iannone rich-iannone deleted the docs-table-themes branch February 27, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants