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

Scale barplot thicknesses relative to tree size; makes default layout barplot lengths look thicker; fix a small Colorer bug #442

Merged
merged 13 commits into from
Nov 10, 2020

Conversation

fedarko
Copy link
Collaborator

@fedarko fedarko commented Nov 8, 2020

Part of the work on #276. This should make barplots look more consistent between the rectangular and circular layouts, and in particular make circular layout barplots' defaults look a lot more legible. Barplot lengths, rather than being in arbitrary units, are now scaled by the tree "thickness" (root to farthest tip width in the rectangular layout, 2 * that distance for the circular layout).

Old:
old

New:
new

Note 1: currently I have this set so that the default barplot layer length, 100, is equal to 1/10th of the tree "thickness." If folks would prefer a thinner default setting, we can adjust the scaling code as needed.

Note 2: I also noticed and fixed a small problem with the Colorer module, where the "freebie" problems with barplot borders we discussed in #400 re-emerged. Basically, this was because rgbToFloat() was being called on a GL array (with colors in the range [0, 1]), not on an RGB array (with colors in the range [0, 255]) -- so the RGB float colors didn't match. I added and tested some code to do the RGB -> GL conversion. I also bit the bullet and added a test that verifies that the "freebie" checking works (i.e. unnecessary triangles aren't being drawn), and added some extra barplot testing code.

Relevant to biocore#276. The reliance on max displacement (which doesn't
seem to have an analogue in the unrooted layout? or maybe we can sort
of treat it the same way as circ layout, idk) means that this might
be too specific a solution to apply to line width thicknesses, but
it should make using barplots a lot less painful
@emperor-helper
Copy link

The following artifacts were built for this PR: empire-biplot.qzv, empire.qzv, empress-tree.qzv, just-fm.qzv, plain.qzv

Copy link
Member

@ElDeveloper ElDeveloper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great just one small suggestion!

empress/support_files/js/drawer.js Outdated Show resolved Hide resolved
@fedarko
Copy link
Collaborator Author

fedarko commented Nov 10, 2020

Thanks @ElDeveloper! Should be addressed now.

I also noticed a small bug where barplot border lengths weren't being scaled in the same way that the other barplot lengths were being scaled -- that should be fixed in 56552f5. (I also changed the default barplot length from 50 to 10, since I think borders being 5% of the tree thickness looked a bit weird -- in practice this looks similar to the previous default setting before this PR.)

@ElDeveloper
Copy link
Member

Thanks @fedarko!

@ElDeveloper ElDeveloper merged commit e982e65 into biocore:master Nov 10, 2020
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.

3 participants