Tradeoffs. When there are no perfect solutions for a data visualization


Hey folks,

It’s great to be back sending out this newsletter and posting videos! I hope you had a chance to check out the critique and livestream that I posted earlier this week. To be honest, I almost didn’t cover these figures because I truly strive to be constructive in this newsletter and in my content. Please feel free to email me if you think I should pull together a more formal description of the issues in the original paper to send to the authors before sending out to Nature Microbiology. My sense is that these types of analyses rarely move the needle. For instance, it took 15 years for Science to issue a retraction on the “arsenic life” paper. In the past few years I have published a thorough critique of two papers on rarefaction (here and here). So far, there has not been a response from the authors of those papers or comment from the broader scientific community.


This week, I’d like to share a figure from another paper published in Nature Microbiology, “Purine bias in bacterial genes is driven by runaway transcription”. This was a bacterial genetics paper that really challenged me! I’m an engineer by training and managed to avoid ever taking bacterial genetics. To whet your appetite for next week’s videos, here is the figure. I encourage you to think about panels b and d. How would you generate those in R?

I’ll discuss this in Monday’s critique, but those two panels take different strategies of dealing with large datasets. There are over 150,000 points represented in those two figures. Panel b is a 2-dimensional histogram that could be generated using geom_hex() and panel d is a scatter plot that could be generated with geom_point(). My question for you is what are the tradeoffs of these two strategies?

The challenge with such a large dataset is showing the texture to the data. The 2-d histogram makes it clear that most of the points is towards the bottom of the plot but that there’s a cluster of points along the diagonal line marked with a 10. The downside for the 2-d histogram is also its strength. We can’t see every individual point. When we have 150,000 points, that is a good thing! Take for example the scatter plot in panel d. To overcome the problems with overplotting, they have drawn the points to be very small circles and added some horizontal or vertical jittering to the points below the limits of detection. Still, from the plot, I cannot tell what fraction of the points are below the limit of detection. That little square in the lower right corner contains about 87% of the points!

Based on this, we might say, “Well, duh, panel d should have been a 2-d histogram like panel b”. By why might the authors have used a scatter plot instead? First off, 87% of the points was about 140,000 points! If they scaled it by thousands like they did in b and divided that square into 10 hexagons, I suspect the scale would need to go from 0 to 14. Most of the hexagons in the plot would have been down around 1 or 2 with a very muted shade of yellow. That would not have given much “texture” to the data to see where there was density in the various populations. My approach would be to cap the scale at a value that would allow me to see the texture. For instance, we could say that the maximum was 3,000 and anything above that would be the maximum color. That color would be represented as “>3,000” in the legend. That might solve the overplotting problem in the scatter plot.

A benefit of the scatter plot is that they could color the points by category. In this case, the fragments overlapping with a known intrinsic terminator got a redish color. But, this wouldn’t have been possible in a 2-d histogram. So, what would you do? My thought would be to present the data as a pair of 2-d histograms - one with all the data and one with just the intrinsic terminators. The benefit is that we can easily deal with the overplotting issue. For instance, I don’t have any intuition for the number of red points that are below the limit of detection relative to those in the upper right quadrant of the figure. The downside of two 2-d histograms is that we are then asking our audience to look back and forth to see if they can spot what we want them to spot in the data.

Compounding the challenge of the 2-d histogram is how we would scale the color of the counts in the two facets. If we use the same color scaling for both facets, it’s possible that we won’t have enough of a dynamic range to see the variation in the intrinsic terminators with the upper end of counts we depict for all the data together. If we use separate color schemes for the two facets then we can see the texture better, but we may lose the ability to compare the fraction of fragments that have intrinsic terminators.

Can you spot any other tradeoffs the authors likely had to make? How would you weigh the different tradeoffs in this example?

As I often try to remind myself and others, this stuff is hard! Ultimately, I find that the best strategy is to ask myself, “What do I want the audience to see in this figure? How will the figure supplement the text that will reference the figure?” That goes a long ways to helping me make choices when there appear to be equally valid (or conflicted!) options.

Workshops

I'm pleased to be able to offer you one of three recent workshops! With each you'll get access to 18 hours of video content, my code, and other materials. Click the buttons below to learn more

In case you missed it…

Here is a livestream that I published this week that relate to previous content from these newsletters. Enjoy!

​
video preview​video preview​

Finally, if you would like to support the Riffomonas project financially, please consider becoming a patron through Patreon! There are multiple tiers and fun gifts for each. By no means do I expect people to become patrons, but if you need to be asked, there you go :)

I’ll talk to you more next week!

Pat

​

Riffomonas Professional Development

Read more from Riffomonas Professional Development

Hey folks, It turns out that I sent out last week’s newsletter a week earlier than I should have. I had every intention of posting a critique video on Monday and doing a livestream on Wednesday. Alas, I didn’t totally have control of my schedule and neither video got up. Regardless, I’m glad I sent the newsletter out last week because it got me going. Inertia is a powerful thing. If we never start - even if it’s a false start - we will never get going. Rest assured that the videos will come...

Hey folks! I’m excited to be firing up the newsletter and YouTube feed again for the academic year. I hope you all had a great summer and were able to get a lot done while enjoying the opportunity to rest a bit. This summer I was able to finally resubmit and publish a manuscript I’ve been working on for a few years to rarefaction. This is now my third paper on rarefaction. Don’t worry, it’s the same story. If you are analyzing microbiome data, please use rarefaction. This paper raised a few...

Hey folks, Earlier this week, those of us in the US celebrated Memorial Day. For many, this marks the unofficial start of summer. I suppose the clock is now ticking until Labor Day, which is the unofficial end of summer. Let me be the jerk to tell you that you have 100 days left to accomplish all of your summer goals. I suspect that for many of you writing papers and putting together conference posters and talks are on your list of goals. Generating attractive visualizations of your data is...