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

multihyp dot plot significance legend is not showing properly (solution included) #56

Open
Vanessa104 opened this issue May 24, 2024 · 3 comments

Comments

@Vanessa104
Copy link

When drawing dot plot Function hyp_dots() when used for a mylti_hyp object.
See the significance legend:
image

This is likely due to the newer version of the package scales. Unsure which version exactly, but it seems like internal function .reverselog_trans() which is based on scales::trans_new() is not working well.

Solution:
https://github.com/montilab/hypeR/blob/master/R/hyp_dots.R
Line 111. Change this line to:
scale_color_continuous(high = "#114357", low = "#E53935", trans = scales::log10_trans(), guide = guide_colorbar(reverse = TRUE))

Or, add this after using hyp_dots() to overwrite the existing function.
hyp_dots(...) + scale_color_continuous(...insert above...)

Example output:
image

tetomonti added a commit that referenced this issue May 24, 2024
tetomonti added a commit that referenced this issue May 24, 2024
tetomonti added a commit that referenced this issue May 24, 2024
tetomonti added a commit that referenced this issue May 24, 2024
@tetomonti
Copy link
Collaborator

Thanks for catching it @Vanessa104. While your solution works, it outputs the warning

Scale for colour is already present.
Adding another scale for colour, which will replace the existing scale.

We need to find a more 'radical' solution.

@anfederico
Copy link
Collaborator

What about trans=c("log10", "reverse")?

@Vanessa104
Copy link
Author

Thanks for catching it @Vanessa104. While your solution works, it outputs the warning

Scale for colour is already present.
Adding another scale for colour, which will replace the existing scale.

We need to find a more 'radical' solution.

The warning is because scale_color_manual is already defined in the hyp_dots() function (at line 111), so defining it again will give you a warning. If we replace the current line 111 with the new code, then there will be no warnings. I didn’t commit the change and created this issue instead, in case there is a better solution or in case there are other developments going on.

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

No branches or pull requests

3 participants