Skip to content

Instantly share code, notes, and snippets.

@raffdoc
Forked from bobthecat/pubmed_pain.r
Created May 16, 2012 17:07
Show Gist options
  • Save raffdoc/2712260 to your computer and use it in GitHub Desktop.
Save raffdoc/2712260 to your computer and use it in GitHub Desktop.
pubmed trend for pain
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment