How to draw this picture | Batch violin plot + box plot + scatter + difference analysis

13a73510c397ef628fdf766cfddd725c.jpeg

cover

written in front

[How to draw this picture] The series of pictures are all from VIP群the students' questions. The tweet is only a reproduction of the picture, and does not mean that the author agrees with the form of the picture. Students are welcome to analyze interesting pictures in the group.

Pictures of this issue

0f49c434f46aee07be664dba2bac3a08.png

「Title:」Typing characteristics of metabolism-related genes in osteoporosis

「Journal:」Front. Pharmacol.

「Doi:」https://doi.org/10.1016/j.eja.2022.126692

read picture

The expression difference box plot represents the difference in expression levels of GPR31, GATM, DDB2, ARMCX1, RPS6, BTBD3, ADAMTSL4, COQ6, B3GNT2, and CD9 genes among the three isoforms.

Nothing special. The box plot drawn before:

  1. Follow Cell to learn graphing | 3. Box plot + scatter + significant difference test

  2. Follow Nat Commun to learn graphing | 1. Batch boxplot + scatter + difference analysis

  3. Follow Nat Commun to learn graphing | 4. Paired box plot + difference analysis

  4. R actual combat | Symmetrical cloud and rain diagram + box plot + paired scatter + error bar diagram + mean connection

  5. Follow Nature to learn to map | Quality control box plot

  6. Follow Cell to learn graphing | box plot + scatter (inter-group + intra-group difference analysis)

Reproduce results

c1a3ac7f602d3a27e8c9920bacad9ed0.png
row1
148f2907b4ed3a47b5cae4453a85323b.png
all

Sample data and code collection

点赞, 在看This article, share it in the circle of friends 集赞30个and 保留30分钟send the screenshot to WeChat mzbj0002to receive it.

"Chuzhou Notes 2022 VIP can receive it for free" .

Note: 2022 will soon pass, for the convenience of readers and friends, it is now launched 木舟笔记永久VIPat a price 169¥. 2022VIPOnly pay the difference to upgrade. 木舟笔记永久VIPEnjoy all the resources of this account (except for limited courses), and no VIP plans will be launched in the future.

Muzhou Notes 2022 VIP Plan

"rights and interests:"

  1. "2022" Muzhou Notes all tweet sample data and codes ( "updated in real time in the VIP group" ).

    91348a5ddebf27b71ee8b7449beab6af.png
    data+code
  2. Muzhou Notes "Scientific Research Exchange Group" .

  3. "Half price" purchase 跟着Cell学作图系列合集(free tutorial + code collection) | Follow Cell to learn drawing series collection .

"TOLL:"

"99¥/person" . You can add WeChat: mzbj0002transfer, or directly reward at the end of the article.

aaa77b5e4ad047c23c400d0eaead253c.png

drawing

# loda data ana preprocess
mRNA <- read.csv("All_mRNA_FPKM.csv",header=T,row.names=1)
#log2
bar_mat <- t(log2(mRNA+1))
# group info
anno <- read.csv("sample_index.csv",header=T,row.names=1)
anno$type2 <- anno$Type
anno <- anno[rownames(bar_mat),]
bar_mat <- bar_mat[rownames(anno),]
bar_mat<- as.data.frame(bar_mat)
bar_mat$sam <- anno$Type

## plot
library(RColorBrewer)
library(ggpubr)
library(ggplot2)
bar_mat$sam<-factor(bar_mat$sam,levels=c("C1","C2","C3","C4"))
# comparisons
my_comparisons <- list(c("C1", "C2"),
                       c("C1", "C3"),
                       c("C1", "C4"))


# gene list
gc <- head( colnames(bar_mat), -1)
#开始批量绘制
plist<-list()
for (i in 1:length(gc)){
  bar_tmp<-bar_mat[,c(gc[i],"sam")]
  colnames(bar_tmp)<-c("Expression","sam")
  pb1<- ggplot(data = bar_tmp,aes(x = sam, 
                                    y = Expression , 
                                    fill = sam))+ 
    scale_fill_manual(values = mycol[c(7,5,3,1)]) +
    geom_violin(alpha = 0.4, position = position_dodge(width = .75), 
                size = 0.8, color="black") +
    geom_boxplot(notch = TRUE, outlier.size = -1, 
                 color="black", lwd=0.8, alpha = 0.7) +
    geom_point(shape = 21, size=2, 
               position = position_jitterdodge(), 
               color="black", alpha = 1) +
    theme_bw() + 
    ylab("Log12(FPKM+1)") +
    xlab(gc[i]) +
    theme(axis.text.x = element_text(size = 12, color = "black"),
          axis.ticks = element_line(size=0.2, color="black"),
          axis.ticks.length = unit(0.2, "cm"),
          legend.position = "none",
          panel.background = element_blank(),
          panel.grid = element_blank(),
          axis.title = element_text(size = 12),
          axis.text = element_text(size = 12)) +
    stat_compare_means(method="t.test",hide.ns = F,comparisons =my_comparisons,label="p.signif")
  plist[[i]]<-pb1
} 

# cowplot
library(cowplot)
p <- plot_grid(plotlist = plist, ncol = 5)
## save
ggsave("boxplot1208.pdf",width = 14,height = 20)
69a6c50a875e1db37c76d43ce5f32268.png

previous content

  1. CNS Chart Reappearance | Biological Information Analysis | R Drawing Resource Sharing & Discussion Group!

  2. How to draw this picture | A bit complicated scatter plot

  3. How to draw this picture | Correlation Analysis Lollipop Chart

  4. Group student letter | Front Immunol | A simple routine for screening early diagnostic markers based on serum proteome

  5. (Free tutorial + code collection) | Follow Cell to learn drawing series collection

  6. Q&A | How to draw beautiful illustrations in papers?

  7. Follow Cell to learn drawing | Mulberry map (ggalluvial)

  8. R actual combat | Lasso regression model establishment and variable screening

  9. Follow NC to map | Advanced interaction network diagram (protein + enrichment pathway) (Cytoscape)

  10. R actual combat | Add a circle to the clustering (ggunchull)

  11. R actual combat | NGS data time series analysis (maSigPro)

  12. Learn to draw with Cell | Venn Diagram (ggVennDiagram)


fa615a000fc510a34c8be6b7d74c87c8.png
Canoe Notes Matrix

Guess you like

Origin blog.csdn.net/weixin_45822007/article/details/128261145