-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix factor colour #131
Fix factor colour #131
Conversation
Amazing, remember that for each PR you should have unit test that proofs you fix. In you changed files I see a lot of plots that change color palette scheme. Is this related with you PR? Also see what issues this PR can be linked to, I think there are couple of issues, and I also tried to solve this without success if I remember well. |
Hi Stefano, I have linked the PR to issue #113 in the description, but don't think I have access to link using the actual development dropdown menu. I can't quite remember why, but it seems factors previously always used a grey colour for one value and then rotated through the rest of the default palette. Maybe the grey colour was intended for NA values, but not being used because the levels were not correctly assigned. Whatever the cause, I think the new output is more in line with what the user might expect when using the default palette. Thank you for the suggestion, I have added a unit test which explicitly tests for annotation tile factor level colour palette order. |
# If factor levels correctly interpreted, colour palette should read in order: | ||
# "first_level", "second_level", "third_level", "fourth_level" | ||
|
||
p = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add another test where you manipulate the factor order
levels = c( "second_level", "third_level", "fourth_level", "first_level")
And you test the effect
If a factor is used to annotate the heatmap, the order of colours provided to
palette
will now match the order of the factor levels.Previously, the
colorRampPalette(palette_annotation$discrete[[.y]])(length(unique(.x))) %>% setNames(unique(.x))
was used to assign factor levels their colour, which does not consider factor level order.This PR fixes issue #113