Ggplot2, PubMed citation frequency and DSM-IV Axis I disorders by year


I an earlier post I used ggplot2 to plot publication count by year for different psychotherapy orientations. I’m using an updated version of that R-code in this post to plot publication count for several major DSM-IV disorders. It’s basically like a very simple discourse analysis.

The search string

I searched for the following disorders: Depression, Bipolar disorder, Post-Traumatic Stress Disorder (PTSD), Attention-Deficit/Hyperactivity Disorder (ADHD), Obsessive-Compulsive Disorder (OCD), Anorexia nervosa, Bulimia nervosa, Social phobia, Panic disorder, Generalized anxiety disorder (GAD), Borderline personality disorder, Agoraphobia and Specific phobia. The following PubMed queries were used:

PubMed Search String

  • Depression[Title/Abstract] (186815 hits)
  • Bipolar disorder[Title/Abstract] (12341 hits)
  • Post-Traumatic Stress Disorder[Title/Abstract] (4294 hits)
  • Attention-Deficit/Hyperactivity Disorder[Title/Abstract] (5121 hits)
  • Obsessive-Compulsive Disorder[Title/Abstract] (7172 hits)
  • Anorexia nervosa[Title/Abstract] (8634 hits)
  • Bulimia nervosa[Title/Abstract] (3547 hits)
  • “Social phobia” OR “social anxiety disorder”[Title/Abstract] (3418 hits)
  • “Panic disorder” OR “panic attack”[Title/Abstract] (8542 hits)
  • Generalized anxiety disorder[Title/Abstract] (2965 hits)
  • Borderline personality disorder[Title/Abstract] (3116 hits)
  • Agoraphobia[Title/Abstract] (2352 hits)
  • Specific phobia[Title/Abstract] (424 hits)

Results — the plots

Number of PubMed hits per year and DSM-IV diagnosis. By Kristoffer Magnusson

Figure 1. ggplot with DSM-IV Axis 1 disorders PubMed publication count by year.

Depression removed and plot zoomed in.
Number of PubMed hits per year and DSM-IV diagnosis. Depression removed. By Kristoffer Magnusson

Figure 1. ggplot with DSM-IV Axis 1 disorders PubMed publication count by year (depression removed).


The word depression is really mentioned much much more often than the other disorders in articles title/abstracts. Among the other disorders there seem to be that some disorders have become more popular in the last decade. Bipolar disorder, PTSD, ADHD and OCD seem to have gotten some extra attention compared to the remaining disorders. Especially bipolar disorder appear to really have become the “it” diagnosis in the last decade. From what I’ve heard from psychologists and psychiatrists working in the swedish psychiatry there seem to be some validity to this conclusion.

Changes to the R code

I made some changes to the R code since. Since I’m importing and reading publication year from individual data files for each disorder, I changed the code to bind each new disorder to the previous one, generating one variable in long format. It would have made a lot of redundant code to plot each disorder on it’s own ggplot2-layer. I also updated the scrape.pubmed()-function to now accept two arguments, where I specified disorder and disorder type (like mood disorder or anxiety disorder). Another change is that I’m now using direct.label() to remove the legend from ggplot and add labels direct to the plot.

The actual code used

Written by Kristoffer Magnusson, a researcher in clinical psychology. You should follow him on Twitter and come hang out on the open science discord Git Gud Science.


Published March 31, 2012 (View on GitHub)

Buy Me A Coffee

A huge thanks to the 64 supporters who've bought me a 143 coffees!

SCCT/Psychology bought ☕☕☕ (3) coffees

Keep the visualizations coming!

@noelnguyen16 bought ☕ (1) coffee

Hi Kristoffer, many thanks for making all this great stuff available to the community!

Eran Barzilai bought ☕ (1) coffee

These visualizations are awesome! thank you for creating it

Someone bought ☕ (1) coffee

@elena_bolt bought ☕☕☕ (3) coffees

Thank you so much for your work, Kristoffer. I use your visualizations to explain concepts to my tutoring students and they are a huge help.

A random user bought ☕☕☕ (3) coffees

Thank you for making such useful and pretty tools. It not only helped me understand more about power, effect size, etc, but also made my quanti-method class more engaging and interesting. Thank you and wish you a great 2021!

@hertzpodcast bought ☕☕☕ (3) coffees

We've mentioned your work a few times on our podcast and we recently sent a poster to a listener as prize so we wanted to buy you a few coffees. Thanks for the great work that you do!Dan Quintana and James Heathers - Co-hosts of Everything Hertz 

Chris SG bought ☕ (1) coffee

Very nice.

@whlevine bought ☕☕ (2) coffees

Thank you so much for these amazing visualizations. They're a great teaching tool and the allow me to show students things that it would take me weeks or months to program myself.

Someone bought ☕☕ (2) coffees

Cameron Proctor bought ☕☕☕ (3) coffees

Used your vizualization in class today. Thanks!

@Daniel_Brad4d bought ☕☕☕☕☕ (5) coffees

Wonderful work!

Gray Church bought ☕ (1) coffee

Thank you for the visualizations. They are fun and informative. bought ☕☕☕ (3) coffees

My students love these visualizations and so do I! Thanks for helping me make stats more intuitive.

Qamar bought ☕ (1) coffee

Someone bought ☕☕☕ (3) coffees

Adrian Helgå Vestøl bought ☕☕☕ (3) coffees

David Loschelder bought ☕☕☕☕☕ (5) coffees

Terrific work. So very helpful. Thank you very much.

Tanya McGhee bought ☕ (1) coffee

@neilmeigh bought ☕☕☕☕☕ (5) coffees

I am so grateful for your page and can't thank you enough!  

@schultemi bought ☕ (1) coffee

@giladfeldman bought ☕☕☕☕☕ (5) coffees

Wonderful work, I use it every semester and it really helps the students (and me) understand things better. Keep going strong.

Dean Norris bought ☕☕☕☕☕ (5) coffees

@misteryosupjoo bought ☕☕☕ (3) coffees

For a high school teacher of psychology, I would be lost without your visualizations. The ability to interact and manipulate allows students to get it in a very sticky manner. Thank you!!!

Sal bought ☕☕☕☕☕ (5) coffees

Really super useful, especially for teaching. Thanks for this!

Neilo bought ☕ (1) coffee

Really helpful visualisations, thanks!

Chi bought ☕☕☕ (3) coffees

You Cohen's d post really helped me explaining the interpretation to people who don't know stats! Thank you!

Someone bought ☕☕☕ (3) coffees

You doing useful work !! thanks !!

@ArtisanalANN bought ☕☕☕ (3) coffees


Someone bought ☕ (1) coffee

This is amazing stuff. Very slick. 

Someone bought ☕ (1) coffee

Sarko bought ☕ (1) coffee

Thanks so much for creating this! Really helpful for being able to explain effect size to a clinician I'm doing an analysis for. 

@jsholtes bought ☕☕☕ (3) coffees

Teaching stats to civil engineer undergrads (first time teaching for me, first time for most of them too) and grasping for some good explanations of hypothesis testing, power, and CI's. Love these interactive graphics!

@DominikaSlus bought ☕ (1) coffee

Thank you! This page is super useful. I'll spread the word. 

Someone bought ☕ (1) coffee bought ☕☕☕☕☕ (5) coffees

Very helpful to helping teach teachers about the effects of the Good Behavior Game

@notawful bought ☕☕☕ (3) coffees

Thank you for using your stats and programming gifts in such a useful, generous manner. -Jess

Mateu Servera bought ☕☕☕ (3) coffees

A job that must have cost far more coffees than we can afford you ;-). Thank you.

Melinda Rice bought ☕ (1) coffee

Thank you so much for creating these tools! As we face the challenge of teaching statistical concepts online, this is an invaluable resource.

@tmoldwin bought ☕ (1) coffee

Fantastic resource. I think you would be well served to have one page indexing all your visualizations, that would make it more accessible for sharing as a common resource.

@cdrawn bought ☕☕☕ (3) coffees

Thank you! Such a great resource for teaching these concepts, especially CI, Power, correlation.

Someone bought ☕ (1) coffee

Fantastic Visualizations! Amazing way to to demonstrate how n/power/beta/alpha/effect size are all interrelated - especially for visual learners! Thank you for creating this?

@akreutzer82 bought ☕☕☕☕☕ (5) coffees

Amazing visualizations! Thank you!

@rdh_CLE bought ☕☕☕☕☕ (5) coffees

So good!

@jackferd bought ☕ (1) coffee

Incredible visualizations and the best power analysis software on R.

Julia bought ☕☕☕ (3) coffees

Fantastic work with the visualizations!

@felixthoemmes bought ☕☕☕ (3) coffees

@dalejbarr bought ☕☕☕ (3) coffees

Your work is amazing! I use your visualizations often in my teaching. Thank you. 

@notawful bought ☕☕ (2) coffees

Thank you for sharing your visualization skills with the rest of us! I use them frequently when teaching intro stats. 

Cameron Proctor bought ☕ (1) coffee

Great website!

Someone bought ☕ (1) coffee

Hanah Chapman bought ☕ (1) coffee

Thank you for this work!!

Someone bought ☕ (1) coffee

Jayme bought ☕ (1) coffee

Nice explanation and visual guide of Cohen's d

Bart Comly Boyce bought ☕ (1) coffee

thank you

Dr. Mitchell Earleywine bought ☕ (1) coffee

This site is superb!

Florent bought ☕ (1) coffee

Zampeta bought ☕ (1) coffee

thank you for sharing your work. 

Mila bought ☕ (1) coffee

Thank you for the website, made me smile AND smarter :O enjoy your coffee! :)

Deb bought ☕ (1) coffee

Struggling with statistics and your interactive diagram made me smile to see that someone cares enough about us strugglers to make a visual to help us out!😍 

Someone bought ☕ (1) coffee

@exerpsysing bought ☕ (1) coffee

Much thanks! Visualizations are key to my learning style! 

@PsychoMouse bought ☕☕☕ (3) coffees

Excellent!  Well done!  SOOOO Useful!😊 🐭 

Someone bought ☕ (1) coffee


You can sponsor my open source work using GitHub Sponsors and have your name shown here.

Backers ✨❤️

Questions & Comments

Please use GitHub Discussions for any questions related to this post, or open an issue on GitHub if you've found a bug or wan't to make a feature request.


There are no webmentions for this page

(Webmentions sent before 2021 will unfortunately not show up here.)

Archived Comments (2)

Neuroskeptic 2012-04-18

Another good post. Some comments -

"Depression" crops up in all kinds of science, e.g. in neuroscience you have "long-term depression" and "cortical spreading depression" which are nothing to do with mood. This is a problem for PubMed counts.

"Bipolar" has taken off, but this may be partly because it's a new name for "manic-depression" / "manic-depressive" a term which went out of fashion (and incidentally manic-depression is tricky to search for because it contains a "-"!)

Also "bipolar" can crop up in other contexts, e.g. "bipolar electrodes" (gets a lot of EEG studies) and some bacteria are bipolar apparantly.

When I've been doing this kind of thing I've used "mania" and "hypomania" as proxies for "bipolar" for that reason.

Kristoffer Magnusson 2012-04-19

Yes, you are correct about "depression". I've been pondering if the query would be more valid if I added something like "AND DSM-x ..."

The same could really be added to all terms, since I am searching for DSM-diagnoses. But I think the term "bipolar disorder" (with quotation marks) would be fairly specific. I will re-run these terms with more elaborate queries, now that I don't have to do it manually. The plot would also be easier to interpret if I added a smoothing function