empress icon indicating copy to clipboard operation
empress copied to clipboard

Support adjusting end angle of circular layout

Open fedarko opened this issue 3 years ago • 2 comments

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:

https://github.com/biocore/empress/blob/e543610c5654399aa1dcbbede09b45b45c4170d0/empress/support_files/js/layouts-util.js#L561

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 avatar Apr 07 '21 03:04 fedarko

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).

fedarko avatar Apr 07 '21 04:04 fedarko

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.

ElDeveloper avatar Apr 07 '21 17:04 ElDeveloper