xbinbzy的个人博客分享 http://blog.sciencenet.cn/u/xbinbzy

博文

ggplot2实现散点图上文字的添加

已有 28817 次阅读 2017-1-12 10:50 |个人分类:R语言画图|系统分类:科研笔记|关键词:学者| 散点上文字添加

数据准备:



实现代码:

library("ggplot2")

png("./pcr.png")

data=read.table("pcr.csv",header=T)

p<-ggplot(data,aes(x=pca1,y=pca2,group=group))+scale_shape_manual(values=c(0,1,2,3,4,5,6,7,8)) + geom_point(size=6,aes(colour=group))+geom_text(label=paste(data$date),colour="black",size=4)

p+theme(axis.title.x=element_text(face="bold",family="Arial",size=20),axis.title.y=element_text(face="bold",family="Arial",size=20),axis.text.x=element_text(family="Microsoft YaHei", size=12), axis.text.y=element_text (family="Microsoft YaHei",size=12))

dev.off()


最终图表




https://m.sciencenet.cn/blog-306699-1027071.html

上一篇:ggplot2实现散点折线图
下一篇:益生菌和致病菌的数据库

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-5 06:31

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部