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

Adjusting DoHeatMap color scale #1531

Closed
sophiecowman opened this issue May 13, 2019 · 2 comments
Closed

Adjusting DoHeatMap color scale #1531

sophiecowman opened this issue May 13, 2019 · 2 comments

Comments

@sophiecowman
Copy link

Is there any way of setting the color scale in DoHeatMap so that 0 is always a specific color e.g white?

This is what happens currently: - you can see that 0 is not in the centre so this can be a little misleading.
image

I can use display.max and display.min to 'even' out the scale like this:
image

but this also means I have clipped off some of the data and it becomes a little less informative.

My code is as follows:
DoHeatmap(object = cluster.averages,features = c("GENE1", 'GENE2', 'GENE3'), size = 3, disp.max = 1.4, disp.min = -1.5) + scale_fill_gradientn(colors = rev(RColorBrewer::brewer.pal(n = 10, name = "RdBu")))

Any help with this would be greatly appreciated!

@yuhanH
Copy link
Collaborator

yuhanH commented May 14, 2019

Try to use scale_fill_gradient2 which can set middle point and color.

DoHeatmap(object = cluster.averages,features = c("GENE1", 'GENE2', 'GENE3'), size = 3, disp.max = 1.4, disp.min = -1.5)+ scale_fill_gradient2( low = rev(c('#d1e5f0','#67a9cf','#2166ac')), mid = "white", high = rev(c('#b2182b','#ef8a62','#fddbc7')), midpoint = 0, guide = "colourbar", aesthetics = "fill")

@yuhanH yuhanH closed this as completed May 14, 2019
@sophiecowman
Copy link
Author

Works great thanks!

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

2 participants