how to customize the color key value in pheatmap

2,821 views
Skip to first unread message

Yong

unread,
Aug 11, 2019, 12:29:37 AM8/11/19
to ggplot2
Dear group members,

color key value.PNG

I plan to have color key value ranging from -2 to 2, not from -2 to 1.5 as shown in the image. I understand this is based on my data since I used the build-in option of pheatmap. I didn't add the argument color = colorRampPalette.

If I use the color argument, I need to set up the break and the corresponding pheatmap didn't have continuous color range.  How should I get the continuous color transition in my heatmap and the color key value is between -2 and 2 if I use the build-in option of pheatmap?

Thanks,
Yong

Ivan Struzhkov

unread,
Aug 11, 2019, 11:25:39 AM8/11/19
to Yong, ggplot2
Hello, as quick solution you could try specify limits in scale fill option

p1 + scale_fill_continuous(limits = c(0,20), breaks = c(0, 5, 10, 15, 20)

where p1 is gg object

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ggplot2/24f15606-1167-4a0d-a85d-a19aee9c31c0%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages