In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "r language how to use ggplot2 to draw bubble chart", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "r language how to use ggplot2 to draw bubble chart" this article.
The results of Pathway enrichment are often shown by bubble chart, and the basic code is as follows:
Case data:
> dat ko_id Kegg_pathway Rich_factor Pvalue DEGs1 ko00195 Photosynthesis 3.543363 1.000000e-15 52 ko00196 Photosynthesis-antenna proteins 5.575221 1.500000e-10 63 ko03008 Ribosome biogenesis in eukaryotes 2.464696 4.920000e-06 74 ko00710 Carbon fixation in photosynthetic organisms 2.567654 4.510000e-05 95 ko01200 Carbon metabolism 1.738592 7.350000e-05 116ko03030 DNA replication 2.453097 1.772599e-03 147ko00030 Pentose phosphate pathway 2.397575 1.772599e-03 128ko00860 Porphyrin and chlorophyll metabolism 2.574238 1.772599e-03 149ko00062 Fatty acid elongation 2.857551 2.316650e- 03 1810 ko00630 Glyoxylate and dicarboxylate metabolism 2.129425 5.299956e-03 1911 ko00230 Purine metabolism 1.671398 5.299956e-03 4
The drawing process of bubble diagram is often realized by using geom_point geometric object function, and the coordinate axis is flipped at the same time.
Note that the significant size-log10 (Pvalue) is mapped to the point color, and the number of differential genes is mapped to the point size.
Kegg_point=ggplot (dat,aes) + geom_point (aes (color=-log10 (Pvalue), size=DEGs) + coord_flip () + scale_color_gradient (low = "green", high = "red") kegg_point
However, it should be noted that in some cases, the number of corresponding DEGs is small, and the size of the automatically matched points is small, so it is difficult to show clearly in the picture, so it can be controlled by scale_size_continuous (range) parameters.
For example:
Kegg_point=kegg_point+scale_size_continuous (range=c (4, 10)) kegg_point
The range parameter corresponding to size can effectively control the range of point size.
These are all the contents of the article "how to draw a Bubble Diagram with ggplot2 in r language". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.