How to draw heat map in R language
This article shows you how to draw a heat map in R language, which is concise and easy to understand, which can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Hello, everyone, although it is the weekend, the editor is still non-stop to share knowledge with you. We usually see all kinds of good-looking heat maps when we look at the literature, and we feel forced to come up in an instant. The official explanation is that heat maps can simply aggregate a large amount of data and show them elegantly using a progressive color. It can directly show the relative size of spatial data. In fact, it is not difficult to draw a heat map, you can also draw a good heat map. Are you ready? it's time to show real technology.
Step 1 install:
Install.packages ("pheatmap") # install pheatmap package install.packages ("RColorBrewer") # install RColorBrewer package library (pheatmap) # load pheatmap package library (RColorBrewer) # load RColorBrewer package
Here is a little introduction to the RColorBrewer package: RColorBrewer is an R package that allows users to create colourful graphs with pre-made color palettes. Why to use it, because his gorgeous and rich color matching deeply attracted the editor, such a good thing must be shared with you. He has three colors. You can use it according to the situation.
Step 2: read the data:
First of all, let's take a look at the format of the data, the first behavior sample name, and the first column gene name.
Fitness