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

Feature request: custom pillar formatting for diagnostic columns #97

Open
mike-lawrence opened this issue Nov 9, 2020 · 10 comments
Open
Labels
feature New feature or request

Comments

@mike-lawrence
Copy link

I believe that the pillar package (used by tibble) permits custom colors, in which case it would be useful to color the contents of the diagnostics columns (rhat, bulk_ess, tail_ess) red if they are below a threshold.

@jgabry jgabry added the feature New feature or request label Nov 10, 2020
@jgabry
Copy link
Member

jgabry commented Nov 10, 2020

I think we currently use the default tibble printing which already colors negative numbers red, so additionally coloring diagnostics could be quite confusing. But to be honest I like the idea of coloring the diagnostics above/below thresholds much better than coloring numbers based on whether they are positive or negative, which could be totally irrelevant.

I think we need to opt for one or the other coloring scheme and not both (unless you have a creative solution to that!). I would vote for what you're proposing here over using the colors for positive and negative. What do others think?

@mike-lawrence
Copy link
Author

For the columns showing parameter summaries (mean, quantiles, etc), I think it'd be useful to still have some distinction between negative and positive, but I propose that red should be reserved for use in the diagnostics columns to indicate something below threshold so that it stands out best. If restricting to the 8 colors that should be pretty universally available, maybe cyan for negative quantities? Seems to be equally legible on light/dark backgrounds.

I should also say I'd volunteer to implement if folks thought this made sense.

@jgabry
Copy link
Member

jgabry commented Nov 10, 2020

Yeah I definitely agree that red is better suited to the diagnostic columns. But I wonder if that will confuse people who are used to the standard that's been set by the tidyverse people to use red for negative numbers. Thoughts?

I should also say I'd volunteer to implement if folks thought this made sense.

Thanks!

@mike-lawrence
Copy link
Author

Oh! How about leaving the negative values as red as tidyverse-standard, but use the ansi background characters to put a red background behind the values in the diagnostics columns that are below threshold? It's not going to look as pretty, but that's kinda the point and it'll really grab the user's attention.

@jgabry
Copy link
Member

jgabry commented Nov 10, 2020

Yeah that's a possibility. I suppose we could also provide options for the user to control what colors are used. Curious what @paul-buerkner @avehtari @mjskay think.

@paul-buerkner
Copy link
Collaborator

I would need to see how it looks in action.

@paul-buerkner
Copy link
Collaborator

How relevant is this issue still in light of implementing #257?

@avehtari
Copy link
Collaborator

@mike-lawrence can you comment on the relevance of this compared to #257 ?

@mike-lawrence
Copy link
Author

Sure, #257 pertains to numeric display while this suggests adding color to those diagnostics with clear pass/fail criteria (rhat, bfmi). Note that it’s via pillar that tibbles came to have custom-specifiable numeric display.

@avehtari
Copy link
Collaborator

Although pillar has the option to color negative values (annoyingly on by default), I have not been able to find documentation or examples with user defined conditional coloring of cells. I see others have asked the same question, but the answers and examples I can find are using some table package like kable, gt, or tinytable, that make nice markdown/html/latex tables, but no user defined conditional color on terminals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants