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

Add size_by argument to model_tree() #720

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

barrettk
Copy link
Collaborator

@barrettk barrettk commented Sep 30, 2024

Core new feature: size_by

  • Allows users to control the node sizing by a particular column present in .log_df

  • Important to note that ofv cant be used without first calling add_summary(), which is consistent with the previous behavior of color_by and include_info.

  • This argument does support logical columns, however I noticed that the normalized sizing can differ here depending when the first TRUE value originates. If it's the first value, all the nodes appear smaller. Anywhere else and the "base size" is larger. This observation is likely true for numeric columns too, though is less apparent when the values are all closer to each other.

    • collapsibleTree::collapsibleTreeNetwork is only intended to support numeric columns for sizing, so I opted to map these values to: TRUE=5, FALSE=1, NA=3 for the time being. We may want to revisit NA values for both numeric and logical columns

image

Other changes

  • Fixed a bug when coloring numeric columns. See details in 6d11e25
  • Added font_size argument. While updating the vignette I foresaw a future request to adjust this, and it was easy enough to pass to collapsibleTree::collapsibleTreeNetwork (with one other change)
  • Updated vignette with new example
  • Formatting fix: dont display tooltips for 'start' node (fc65532)
  • Css simplifications and other minor adjustments

 - Allows users to control the node sizing by a particular column present in `.log_df`

 - Important to note that `ofv` cant be used without first calling `add_summary()`, which is consistent with the previous behavior of `color_by` and `include_info`

 - This argument does support logical columns, however I noticed that the normalized sizing can differ here depending when the first `TRUE` value originates. If it's the first value, all the nodes appear smaller. Anywhere else and the "base size" is larger. This observation is likely true for numeric columns too, though is less apparent when the values are all closer to each other.
    - `collapsibleTree::collapsibleTreeNetwork` is only intended to support numeric columns for sizing, so I opted to map these values to: TRUE=5, FALSE=1, NA=3 for the time being. We may want to revisit NA values for both numeric and logical columns

 - Added examples to docs
 - While the implementation and tests are done, I think we still want to revist the NA handling, which also impacts the "start" node size.
@barrettk barrettk requested a review from seth127 October 4, 2024 16:34
 - While updating the vignette, I noticed that the size_by and color_by arguments occasionally didnt line up for numeric columns. Numeric columns need to be sorted first so the right colors are assigned. This was previously "tested" using the character 'run' column, though was more observable when testing against objective function values (which dont necessarily appear in ascending/descending order)
 - uses leafCount, which makes the nodes containing more child nodes, larger
 - Improve formatting of code in some cases
 - Adds additional tests when required or specified columns are missing

 - doc adjustments
 - If color_by or size_by is specified, ensure these columns are also part of the tooltip. This avoids the need for specifying new columns (e.g., 'Out of Date') in both the tooltip and color_by
 - doc and text adjustments
 - Revert change from previous commit (comment it out) until a decision has been made.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant