在R中用emoji画文献数量统计图

背景:导师让画五角星,但是ggplot没有… 所以用的emoji画的图

1. 数据下载

知网

检索结果选取中文数据
导出与分析 -> 导出文献 -> 自定义

选择保存为xls格式

删除多余的信息,剩下年份后另存为csv/excel格式后导入到RStudio中

> library(emojifont)
> library(jjb)
> external_graphs()
> View(lateblight) 
> lateblight_count <- data.frame(as.data.frame(table(lateblight)),shape=fontawesome('fa-star'))
> names(lateblight_count) <- c('year','count','shape')

WOS

> wos <- wos$V45
> wos <- wos[-1]
> wos_count <- data.frame(as.data.frame(table(wos)),shape=fontawesome('fa-circle'))
> names(wos_count) <- c('year','count','shape')

合并数据集

count <- rbind(wos_count,lateblight_count)
count$year <- as.numeric(as.character(count$year))

2. 画图

library(ggplot)
ggplot(count, aes(year, count, colour=shape, label=shape))  
+ geom_point(size=-1) 
+ geom_text(family='fontawesome-webfont', size=5, show.legend=FALSE,alpha = 0.9, position = position_dodge(0.8))
+ theme(
plot.title = element_text(size = 30, face = "bold", color ="black",hjust = 0.5,vjust=0),
axis.text.x  = element_text(face = c('bold','plain','plain','plain','plain','bold')),
panel.background = element_rect(fill = 'white',color="grey"),
panel.grid.major = element_line(color = "lightgrey"),
legend.text=element_text(size=22),
axis.text=element_text(size=20),
axis.title =element_text(size=25),
axis.title.x=element_text(vjust=-2),
axis.title.y=element_text(angle=90, vjust=2.5),
plot.margin = unit(c(1.5,1.5,1.5,1.5), "cm"))
+ggtitle("马铃薯晚疫病文献信息\n")+labs(x="出版年份",y="文献数量")
+scale_x_continuous(breaks =c(1920,1940,1960,1980,2000,2020))
+scale_colour_discrete("",labels=c("中文文献","英文文献"),guide=guide_legend(override.aes=list(size=4)))
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值