-
Notifications
You must be signed in to change notification settings - Fork 129
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
Thoughts/Updates for {gtsummary} themes #1580
Comments
If I may, some additional thoughts. If the "theme env" is saved with the tbl object, you could consider two different options: Another thought is the question of inheritance of theme elements. It exists in the code in many places, without being explicit. An example: Lines 153 to 157 in 30ef717
We could think about a better naming of the theme elements, showing the inheritance. An example:
Then the code could be simplify in many places. We could simply call Another thought coming from |
Also, an internal function called when package is loaded to fix the default values at once would be relevant, to avoid indicating default values within each function. |
@larmarange and I recently had a chat about gtsummary themes. @larmarange indicated some students have confusion with gtsummary themes because they are specified differently than ggplot2 themes.
Admittedly, I do prefer the ggplot2 specification using
ggplot() + geom_line() + themes()
. But I am not sure how I could make this work in gtsummary. Essentially we would need to delay the calculation of everything until the print (oras_gt()
,as_kable()
etc) is called. That would require much more complex environment handling and a major re-write. While not impossible, I dont know if that added complexity is worth trying to unify ggplot and gtsummary notation. I'll keep thinking on it...maybe it will be worth it!There was another thing I was thinking about regarding themes' current implementation that I do not love: If I set a theme at the top of a script and create a gtsummary table and save out the object, the theme is only active for the parts that are used during the construction of the table. If I were to load the saved gtsummary table in another script, and print it, any theme elements that control the defaults in the
as_gt()
function would not be activated unless I were to load the same theme into the env before printing. This is something that has confused users. Perhaps, we could instead save the "theme env" with the gtsummary object when thetbl_*()
functions are called and the themes would be available for thattbl_*()
object in any environment.The text was updated successfully, but these errors were encountered: