I don't think they need to do anything as sophisticated as a query, they're just looking at how many questions are tagged for each language (which you can see from the tag search page) and then plotting those on a logarithmic scale.
I don't think they even plot the tag numbers on any scale. It looks from the graph like it's just graphing the "rank" (but actually inverse rank), so they sort the languages by # of tags and give each position an inverse score corresponding to the rank (#1 gets 102 "points", #2 gets 101, #3 gets 100, etc.).
> Credit: My colleague Rachel Stephens wrote the queries that are responsible for the GitHub axis in these rankings. She is also responsible for the query design for the Stack Overflow data.
RedMonk has said they use the Stack Overflow Data Explorer tool but I don't know (though perhaps they've written about in the past) the exact queries they use.