Wednesday, 25 November 2015

Generate a PDF version of the Google Scholar citation histogram

Google Scholar provides a nice way to illustrate your citation records as histogram:

I wanted to add it to my publication record document, but the problem is we cannot save as a picture. We could save as a screenshot but as bitmap, it will look blurry. Hopefully, I find a nice way to reproduce the plot with R ( and ggplot2 (

First, create a simple file called "google_record.txt", which contains the following information:
2015 208
2014 159
2013 100
2012 58
2011 44
2010 30
2009 22
These numbers are simply obtained by rolling the mouse over the plot in the webpage of google scholar. Of course, don't forget to change the values by your numbers. ;)

Then, launch R and type the following commands:
if (!require("ggplot2")) {
   install.packages("ggplot2", dependencies = TRUE)

df <- read.table("google_record.txt")

ggplot(df,aes(x=factor(V1), y=V2))+geom_bar(stat = "identity", fill="gray40")+
    theme(panel.background= element_blank())+
    theme(panel.grid.major.x = element_blank())+
    theme(panel.grid.major.y = element_line(size=0.5, color="grey"))+
    theme(panel.grid.minor.y = element_line(size=0.5, color="grey"))+
    theme(axis.ticks = element_line(size = 0.5, colour="grey"))+
    theme(axis.text = element_text(colour="black", size=rel(1.2)))+
    labs(title = "Citations per year", x="", y="", size=rel(1.3))


You will then obtain a clean PDF file to include in your document.

1 comment:

  1. Thanks for taking time to share this post. It is really useful. Continue sharing more like this.
    R Programming Training in Bangalore