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

Support adjusting end angle of circular layout #509

Open
fedarko opened this issue Apr 7, 2021 · 2 comments
Open

Support adjusting end angle of circular layout #509

fedarko opened this issue Apr 7, 2021 · 2 comments

Comments

@fedarko
Copy link
Collaborator

fedarko commented Apr 7, 2021

I thought we already had an issue for this, but apparently not!

Motivation: Lots of tree figures (e.g. Figure 1a in this paper I was reading) have a "gap" between between the start and end angle in the circular layout, which can look nice. In EMPress, we don't have this sort of gap by default, so the tree takes up an entire 360 degrees (or 2pi radians) of space:

lol

Changing this when re-doing the circular layout is actually pretty simple -- we should only need to adjust one line:

var anglePerTip = (2 * Math.PI) / tree.numleaves();

Changing the numerator in this line from 2*pi to 1.9*pi gives us this:

image

...And just 1*pi, for reference:

image

This even works well with barplots out of the box:

image

It should be possible to add a UI element (ideally the sort of thing that is only visible when the circular layout is active) that adjusts this value -- I guess it would be most user-friendly to take inputs in degrees and then transform them to radians internally.

A solution to this issue would pair really well with #359, although the issues aren't necessarily dependent on each other or anything.

@fedarko
Copy link
Collaborator Author

fedarko commented Apr 7, 2021

We should impose a reasonable lower limit of maybe pi / 2 (90 degrees) or something similar -- it looks like length scaling gets messed up when setting the total angle span to pi / 10:

image

... Not sure what is causing this - likely weird precision stuff, and/or the approximations we use for circular layout barplots causing problems (#508).

@ElDeveloper
Copy link
Member

This looks like a great addition. Adding a slider that only updates the layout when the selector is released would likely avoid freezing the UI when the trees are large. And perhaps including this as a sub-item to the "Circular" option in the layout tab, since I think this is a "layout" option.

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

2 participants