其他
贵圈真乱
上周发的这个贵圈好乱的图,很多小伙伴不清楚缘由,也有很多小伙伴求画图代码。
代码很简单,无非x轴是论文发表时间,而y轴是按照类别来的,y轴我直接给数字,而不是以factor形式,一来是点比较少,二来是有两个点重叠了,要调整一下。然后就是用annotate
加曲线和标记抄袭plagiarism
的文本,这里也是可以写代码自动确定xy轴的值的,但点实在太少,看图直接写来得还快一点,所以王八拳来一套。
d <- data.frame(pkg = c("GOSim", "GOSemSim", "DOSE", "meshes",
"DOSim", "HPOSim", "ppiPre", "MeSHSim", "meshr"),
year = c(2007, 2010, 2015, 2018, 2011, 2015, 2013, 2015, 2015),
journal = c("BMC Bioinformatics", rep("Bioinformatics", 3),
"BMC Bioinformatics", "PLoS One", "BMC Systems Biology",
"Journal of Bioinformatics and computational biology",
"BMC Bioinformatics"),
y = c(1, 1, 2, 3, 2, 4, 5, 2.8, 3.2))
require(ggplot2)
ggplot(d, aes(year, y)) + geom_label(aes(label=paste(pkg, "\n", journal))) +
scale_x_continuous(breaks=2007:2018, limits=c(2006.5, 2018.5)) +
annotate("curve", x=2012, y=5, xend=2010, yend=1.2, colour="steelblue", size=1.2, arrow=arrow(length = unit(0.03, "npc"))) +
annotate("curve", x=2014.4, y=4, xend=2011, yend=2.2, colour="steelblue", size=1.2, arrow=arrow(length = unit(0.03, "npc"))) +
annotate("curve", x=2010.1, y=2, xend=2007, yend=1.2, colour="steelblue", size=1.2, arrow=arrow(length = unit(0.03, "npc"))) +
annotate("text", x=2010, y=4, label="plagiarism", color = "firebrick", size=5, hjust=1) +
annotate("text", x=2012.5, y=4, label="plagiarism", color = "firebrick", size=5, hjust=1) +
annotate("text", x=2008.5, y=2.3, label="plagiarism", color = "firebrick", size=5, hjust=1) +
ggtree::theme_tree2()
至于不知道缘由的,请猛击以下的八卦连载: