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

Don't resize legend when changing non-color-related things? #533

Open
fedarko opened this issue Jul 17, 2021 · 0 comments
Open

Don't resize legend when changing non-color-related things? #533

fedarko opened this issue Jul 17, 2021 · 0 comments

Comments

@fedarko
Copy link
Collaborator

fedarko commented Jul 17, 2021

This isn't really a bug, but I think some users might get annoyed by this.

The changes I added in #512 automatically resize the tree coloring legend whenever sample/feature metadata coloring is updated. This is usually a good thing, since it means the legend will adjust to the size of its contents (so it'll get small if the tree is only colored by a few categories, and it'll expand -- up to its maximum size -- if the tree includes lots of categories).

However, a minor problem with this is that the legend is also resized when the tree coloring assignments aren't actually changed but when other things about tree coloring are changed: e.g. toggling clade collapsing, reversing the color map, adjusting the tip vs.all option for feature metadata coloring*, adjusting line width. This can get annoying if we're coloring the tree by a field, we've resized the legend, and we're adjusting other things about the tree -- because the legend will keep snapping back to its default size. This is especially noticeable in EMPire plots when the available screen space is small:

Peek 2021-07-16 20-49

There are probably a few different ways we can handle this, but maybe the most straightforward would be something analogous to what @ElDeveloper proposed (albeit in a different context) in #526 -- where we make note of the currently selected field for tree coloring and don't call Empress.resizeLegend() from Empress.updateLegendCategorical() unless the currently selected field differs from the previously selected field.

* Note: Adjusting the legend size does actually make sense for this case -- since changing the tip vs. all thing can change the unique values shown in the legend. But for e.g. clade collapsing or color map reversing, I think it'd be better if the legend size wasn't adjusted here.

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

No branches or pull requests

1 participant