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

color palette in plotXDEHm #15

Open
resabut opened this issue Jul 3, 2023 · 1 comment
Open

color palette in plotXDEHm #15

resabut opened this issue Jul 3, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@resabut
Copy link

resabut commented Jul 3, 2023

Hi,
I am trying to plot my XDE results with the plotXDEHm function, but I get this error:
Error: Length of `breaks` should be equal to `colors`.

Debugging brought me to line 142 in plotXDEHm

pt_col_fun = circlize::colorRamp2(seq(1, max(colann$pseudotime)), colorRampPalette(brewer.pal(n = 9, name = "YlGnBu"))(max(colann$pseudotime)))

My max pseudotime value is an integer, say 13.285, so then the breaks and colors arguments have different length.

seq(1, max(colann$pseudotime))
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13
colorRampPalette(brewer.pal(n = 9, name = "YlGnBu"))(max(colann$pseudotime))
 [1] "#FFFFD9" "#F3FAC0" "#E4F4B1" "#CCEBB3" "#A5DCB7" "#7ACBBB" "#54BDC1"
 [8] "#35AAC2" "#1F93C0" "#1F75B3" "#2257A4" "#243D98" "#192B7C" "#081D58"

That is 13 vs 14 elements.
I am guessing this is because in the seq function, floats are floored in the from= parameter, whereas they are rounded up in length.out

> seq(1, 2.8)
[1] 1 2
> seq(1, 2, length.out=2.2)
[1] 1.0 1.5 2.0
@Winnie09 Winnie09 added the enhancement New feature or request label Sep 17, 2023
@Winnie09
Copy link
Owner

Thank you @resabut ! I made a note about this and will enhance the plot function in the next version! For now, I guess it will be easier to just modify the function on your end. Please let me know if you need other assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants