· Resource · 4 min read

Dynamic graphs on the website

Adding graphs to a website can be powerful, especially when they update automatically. This is a test graphing (automatically) the top 5 journals we publish in. I'm exploring this technique to share data in the future.

Adding graphs to a website can be powerful, especially when they update automatically. This is a test graphing (automatically) the top 5 journals we publish in. I'm exploring this technique to share data in the future.

Ok, cool. Let’s see if this works! I’m using ChartJS for now to graph this. A javascript component grabs data from our publications and counts how often each journal is there. Then the top 5 is put in a bar graph.

Where do we publish?

With who do we publish?

Nice! Now I can use this technique to share data in the future. Ideally I hope to use this to share sequencing data as well, but that might be challenging given the size. For now it’s fun for statistics and fun little projects.

Citations and publications

per year

cumulative

Update, November 2026: how it is all built

This test got a bit out of hand. There is now a whole page of these: the lab in graphs. Since people ask how it works, here is the short version.

The data

Nothing is typed in by hand, except the list of lab members. Every time the website is rebuilt, a small script asks three sources for fresh data:

  • PubMed for the list of our papers, with authors, journal and date.
  • Google Scholar for the number of citations per paper and per year.
  • OpenAlex for where our co-authors work: the institutions they list on each paper, and the city and coordinates of those institutions.

The answers are saved as plain JSON files next to the code. If a source is down, the previous file is kept, so a hiccup at PubMed never breaks the site. A new paper shows up in every graph by itself after the next rebuild.

Graphs drawn in your browser

The bar charts, the line charts, the citations per paper and the network are still Chart.js, as in the original test. Each one is a small component that receives the data, counts what it needs (papers per journal, papers per co-author, citations per year) and hands the result to Chart.js. They only load when you scroll to them, so a page full of graphs still opens quickly. The colors are read from the same settings as the rest of the site, which is why the graphs follow you into dark mode.

The network is a force-directed graph: every author is a node, and every shared paper is a spring that pulls two authors together, while all nodes push each other away a little. The layout is calculated once and then frozen, so it does not wobble around while you look at it.

Co-authorship network · node size = paper count · edge color = paper · edge weight = shared papers

Maps drawn in advance

The maps work differently: they are finished before the page reaches you. While the site is built, d3-geo takes the country outlines from world-atlas and projects them (Equal Earth, so countries keep their true relative size). The outlines have far more detail than a map this size can show, so points closer together than about half a pixel are thrown out. What is left is written into the page as a plain drawing (SVG). Your browser gets no map library at all, only a few lines of script for the tooltips.

For the collaboration map, every institution from OpenAlex is placed in its city. Cities within 10 km of each other become one dot, because Boston and Cambridge are really one place. The size of a dot is the number of co-authors there, and a line joins two cities that appear on the same paper. Half of the network sits in the Netherlands, in cities a few pixels apart on a world map, hence the close-up.

344 co-authors in 51 cities and 17 countries · dot size = co-authors · line weight = shared papers · the Netherlands enlarged

The team map on the about page is made the same way, from the home countries in the team list.

No library at all

The lab timeline on the graphs page is the simplest of the lot: a list, where every person is a bar positioned with two percentages, the day they joined and the day they left. No graphing library, no script, only HTML and CSS. Not everything needs a framework.

Back to LabNotes

Related Posts

View all posts »
Who do you know that I know?

Who do you know that I know?

A small tool to find shared collaborators between any two researchers; useful for finding warm introductions, vetting speakers, or just satisfying scientific curiosity.

How to email a PI?

How to email a PI?

I get a lot of ineffective emails with requests to join my lab for long or short term. Here is a short guide to improve your success rate!