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

Plotting Three Continuous Palettes #92

Open
atly2000 opened this issue Nov 18, 2022 · 0 comments
Open

Plotting Three Continuous Palettes #92

atly2000 opened this issue Nov 18, 2022 · 0 comments

Comments

@atly2000
Copy link

I would like to plot a pheatmap for a dataframe with values ranging from -9.96 to 15.
I want to center the white portion at the value of 10.

I was able to center the white portion, but the "midnightblue" range is very small. I expected more colors between -9.96 to 5.

How can I adjust my breaks?

image
image

colors <- c(seq(minval, midblueval,by=0.01),seq(mid1,mid2,by=0.01),seq(max1,max2,by=0.01))
minval = log2(0.001) #-9.96
midblueval = (5+minval)/2 #-2.5
mid1=  8
mid2=  12

max1 =13
max2=15


len1=(midblueval-minval)/0.01  

len2=(mid2-mid1)/0.01
len3=(max2-max1)/0.01
my_palette <- c(colorRampPalette(colors = c("midnightblue","blue"))(len1),
                colorRampPalette(colors = c("blue", "white", "red"))(len2),
                colorRampPalette(colors = c("red","red4"))(len3)
)

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

1 participant