-
Notifications
You must be signed in to change notification settings - Fork 83
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: add examples to the documentation #618
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #618 +/- ##
=======================================
Coverage 90.84% 90.84%
=======================================
Files 46 46
Lines 5417 5417
=======================================
Hits 4921 4921
Misses 496 496 ☔ View full report in Codecov by Sentry. |
columns in various ways. For example, you can create three bottom spanners by specifying `level=0` | ||
and a top spanner by setting `level=1`: | ||
|
||
```{python} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, you could leave out all uses of the level=
arg and still get the same result (because of the 'stacking' implementation). I say keep it, but remove the uses of level=
.
Maybe a better example after that (after the 0-2 level one you added) is to use a level=
when stacking works against you.
Perhaps some variation of this (could use a different dataset if preferred):
colnames = ["model", "hp", "hp_rpm", "trq", "trq_rpm"]
gtcars_mini = gtcars[colnames].head(10)
(
GT(gtcars_mini)
.tab_spanner(
label="hp",
columns=["hp", "hp_rpm"],
)
.tab_spanner(
label="performance",
columns=["hp", "hp_rpm", "trq", "trq_rpm", ],
)
.tab_spanner(
label="trq",
columns=["trq", "trq_rpm"],
level=0
)
)
In the above, if that last tab_spanner()
didn't have level=0
it would be automatically in level 2
. Instead, because there is space in level 0
above columns "trq"
and "trq_rpm"
, it can be placed in level 0
. I know you could modify the order of calls to avoid the level=
use, but an example like this still seems useful for teaching how level=
works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rich-iannone , thanks for the great suggestion! It helps us introduce the stacked functionality and the level=
parameter of tab_spanner()
to users in a clearer way.
@@ -1000,6 +1095,11 @@ def val_fmt_image( | |||
------- | |||
list[str] | |||
A list of formatted values is returned. | |||
|
|||
See Also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cross reference!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are welcome additions to our documentation! My only ask is to refine the extra examples for tab_spanner()
(suggestions provided).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
Hello team,
This PR improves our documentation by adding missing examples, primarily for the
vals
module. The goal is to provide simple code snippets that users can easily copy and run.