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

show in html is a bit hard to read #3378

Open
juliohm opened this issue Sep 8, 2023 · 8 comments
Open

show in html is a bit hard to read #3378

juliohm opened this issue Sep 8, 2023 · 8 comments
Assignees
Labels
Milestone

Comments

@juliohm
Copy link
Contributor

juliohm commented Sep 8, 2023

Hi, I am opening this issue just to confirm that this is the intended behavior of show in html:

image

The numeric values are so shifted to the right that it is a bit hard to associate the values with the correct headers. Any chance this alignment could be changed to a centered alignment?

@bkamins bkamins added the display label Sep 8, 2023
@bkamins bkamins added this to the 1.7 milestone Sep 8, 2023
@bkamins
Copy link
Member

bkamins commented Sep 8, 2023

The idea was to align numeric values to a decimal point. But I can see that in fact we do not do this anyway (we do it in text/plain).

But maybe the easiest way to go is to add vertical lines clearly showing columns. What do you think @ronisbr?

@ronisbr
Copy link
Member

ronisbr commented Sep 8, 2023

Hi @juliohm !

That huge padding is strange. The columns should be sized to fit the longest cell, which in this case is the header / subheader. I cannot reproduce the results in Jupyter. Take a look how I see a table with the same set of data:

Captura de Tela 2023-09-08 às 18 43 29

How can we replicate it?

But maybe the easiest way to go is to add vertical lines clearly showing columns.

I personally hate vertical lines :D Furthermore, I am not sure if there is a way to easily do this kind of modification inside Jupyter.

@juliohm
Copy link
Contributor Author

juliohm commented Sep 8, 2023 via email

@bkamins
Copy link
Member

bkamins commented Sep 9, 2023

Maybe some CSS configuration in Quatro could resolve the issue?

@juliohm
Copy link
Contributor Author

juliohm commented Sep 9, 2023 via email

@ronisbr
Copy link
Member

ronisbr commented Sep 9, 2023

@juliohm in the mean time, you can pass alignment = :c to show to improve things in Quarto:

show(stdout, MIME("text/html"), df; alignment = :c)

@bkamins I think it will be really hard to provide a default that will work in every environment. Maybe it is time to revisit that old request to provide a way to set default options when printing tables. Thus, each user can customize depending on the environment.

My suggestion is to add Preferences.jl to PrettyTables.jl, replacing any configuration if a specific preference is set. Hence, the options there will take precedence to everything: default PrettyTables.jl values and also DataFrames.jl customizations.

What do you think?

@bkamins
Copy link
Member

bkamins commented Sep 9, 2023

Having thought about it I saw the following aspects:

  • should setting be per session or across sessions
  • should setting affect all tables or only a specific table
  • if we set option "A" should it disable any other customizations or only option "A" should be affected

While there can be several answers to these questions I, tentatively, came to the conclusion that a mechanism similar to what plotting backends provide might be sensible:

  • users could register display settings (call them "themes"); PrettyTables.jl itself could also provide several in-built settings (these settings should be per MIME). The API for registering a theme would need to be worked out.
  • then in run time user could run something like PrettyTables.activate_themes(the sequence of themes to be activated as consecutive positional arguments) then the activated themes would override the settings passed by the user (i.e. they would be applied after kwargs passed by the user were processed). Running PrettyTables.activate_themes() would disable all themes. The sequence of themes would be accepted because they would be applied in sequence (as they potentially could overlap).

CC @nalimilan

@ronisbr
Copy link
Member

ronisbr commented Sep 9, 2023

I fully agree with this approach of having themes for each backend. I will do some testing to check if it does not introduce too much overhead. The last time (I think in Julia 1.2 or 1.3) I tried to do something like this, the package was taking more than 1s to print a table for the first time.

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

No branches or pull requests

3 participants