ggplot2折线图

mac2026-08-31  8

library(ggplot2)

#读入数 data= read.csv("E:/lcs/0.smart-seq2/0.data/3.细胞平行性/平均相关系数.csv")

data$stage = factor(data$stage,levels = c("Zy","2C","8C","Mor","Blast")) Groups = factor(data$comparison)

#添加字体

windowsFonts(myFont1=windowsFont("Times New Roman"))#保存图片,设置大小,分辨率 tiff(file="C:/Users/Administrator/Desktop/myplot.tiff", width=200, height=200,units='mm',res=500,compression='lzw')#画图 ggplot(data, mapping = aes(x =data$stage,y = data$皮尔森相关系数, group=Groups, colour = Groups)) + geom_line(size=1.5)+ geom_point(size=4)+   xlab("Stages")+ylab("Pearson correlation coefficient")+   theme_classic()+   theme(panel.grid=element_blank(),         axis.title.x =element_text(size=20,family = "myFont1",color = "black",face = "bold"), axis.title.y=element_text(size=20,family = "myFont1",color = "black",face = "bold")         ,axis.text.y=element_text(size=20,family = "myFont1",color = "black"),axis.text.x=element_text(size=20,family = "myFont1",color = "black"),         legend.text = element_text(size=20,family = "myFont1",color = "black"),legend.title = element_text(size=20,family = "myFont1",color = "black",face = "bold")) dev.off()

#进一步调主题 library(ggThemeAssist) ggThemeAssistGadget(a)

最新回复(0)