source('pubmed_trend.r') sex.pub <- pubmed_trend(search.str = 'Sex+Characteristics[mh] AND Pain[mh]', year.span=1970:2011) analgesic.pub <- pubmed_trend(search.str = 'Sex+Characteristics[mh] AND Analgesics[mh]', year.span=1970:2011) source('plot_bar.r') library("RColorBrewer") pdf(file='sex_pain.pdf', height=8, width=8) par(las=1) colorfunction = colorRampPalette(brewer.pal(9, "Reds")) mycolors = colorfunction(length(sex.pub)) plot_bar(x=sex.pub, linecol="#525252", cols=mycolors, addArg=FALSE) colorfunction = colorRampPalette(brewer.pal(9, "Blues")) mycolors = colorfunction(length(analgesic.pub)) plot_bar(x=analgesic.pub, linecol='black', cols=mycolors, addArg=TRUE) title('Number of publication per year') legend('topleft', legend=c('Sex and Pain', 'Sex and Analgesics'), fill=c("red", "blue"), bty="n", cex=1.1 ) dev.off()