技巧一:X 轴调整角度和大小
ggplot(cibersort_result_L,aes(x=TILs,y=value,fill=group))+geom_boxplot()+
stat_compare_means(method = "wilcox.test",label="p.signif")+
theme(axis.text.x = element_text(angle = 90, hjust = 0.5, vjust = 0.5,size = 18))+
theme(axis.title = element_text(angle = 45,hjust = .5, vjust = .5, size = 20))
image.png
技巧二:了解RColorBrewer的配色
library(RColorBrewer)
display.brewer.all(type = "all")
brewer.pal.info
image.png
使用方法
+
scale_fill_brewer(palette="YlGnBu")
image.png
或者使用自定义颜色填充
+
scale_fill_manual(values=c("#999999", "#E69F00", "#56B4E9","black","red","chocolate","deeppink","darkmagenta",
"#000000", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7",'green',"#999999",
"#E69F00", "#56B4E9","black","red","chocolate","deeppink","darkmagenta"))
技巧三:ggplot 主题
参考
https://blog.csdn.net/Bone_ACE/article/details/47267505#%E8%87%AA%E5%B8%A6%E4%B8%BB%E9%A2%98
ggplot2自带的两个主题:
theme_grey() 、theme_bw()
ggthemes包的十个主题:
安装ggthemes包以后便可使用如下十个主题:
theme_economist() 、theme_economist_white() 、theme_wsj() 、theme_excel() 、theme_few() 、theme_foundation() 、theme_igray() 、theme_solarized() 、theme_stata() 、theme_tufte()
使用方法
+
theme_grey()
网友评论