-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Improve HTML reprs #10816
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
base: main
Are you sure you want to change the base?
Improve HTML reprs #10816
Conversation
The strategy I was using is counting the number of hidden items (at any level), with the idea being that it should be obvious if a large amount of data is hidden. Otherwise you could have a collapsed group marked as "(1)" that hides hundreds of data variables, which felt wrong to me.
Do you think this is common? I don't think we do this for the other Xarray HTML reprs. They get collapsed but nodes are not truncated at the top level.
I am currently displaying DataTree elements in priority order, based on showing the top-most levels as completely as possible (breadth-first). We could start by going deep (depth-first), but this would mean that some high-level nodes could be truncated. Maybe there's some compromise algorithm that could work better? |
This PR adds a number of improvements and revisions to the Xarray's HTML reprs, especially for DataTree:
:active
selector doesn't always go away when focus is moved elsewhere)display_max_items
anddisplay_max_html_elements
for controlling at what point the DataTree HTML repr collapses and truncates nodes, instead of doing this all based ondisplay_max_children
.This needs a few more tests and release notes, but is ready for feedback! @jsignell @TomNicholas @benbovy
whats-new.rst
Code to generate HTML previews:
Revised (this PR)
Interactive preview
Baseline
Interactive preview