Elaborate Matplotlib animations

Matplotlib, Python’s primary scientific plotting library, provides tools to make many elaborate plots, graphs, and diagrams. Many of these can be animated, but the process isn’t always intuitive. The hardest part is learning how to animate a simple line plot (here’s my easy way). Beyond that, the steps to creating most animations tend to be similar.

The examples below demonstrate the particular methods needed to animate common types of plot. Here I focus on the key components needed for updating each frame of the animation. The full code for the examples is here. It includes liberal and arbitrary use of sines and cosines so as to produce looping gifs.

Scatter with variable colour, position, and size

scatter

Continue reading “Elaborate Matplotlib animations”

Scientific software skills make up for minimal artistic talent

A computer is a better artist than I am. If I can tell it what to draw, it will produce attractive results. To make a nice schematic, the hardest part is to tell the computer what I want to draw. Fortunately for us so-called left-brain types prevalent throughout the sciences, a familiarity with scientific software can overcome a lack of artistic talent, allow rapid iteration of a design, and even provide creative inspiration.

Invoking my scientific software skills, I am able to produce elegant figures:

shear_rotation_schematic

 

Now, compare that with my initial sketch…

shear_schematic_sketch

Continue reading “Scientific software skills make up for minimal artistic talent”

Pure scientific research pays for itself

Pure scientific research is economically viable because it has a fat tail. Science is expensive, but sporadic breakthroughs lead to economic benefits that more than cover the bill for the other studies. If you could buy stock in Pure Scientific Research, it would be a worthwhile investment, with estimated returns on investment of 20–60%. The catch? You have to share your returns with everyone else. They aren’t appropriable as an economist would say.

The importance of pure scientific research to the vast majority of modern life cannot be understated. But this importance is hidden. The tech, pharma, and auto companies that we buy products from undertake their own research and development, but it exists upon a base of fundamental science discovered within university walls. This link between pure research and modern day technology would be more obvious if, as Bruce Parker suggests, there were “Science made this possible” signs on every appliance, drug, car, computer, game machine, and other necessities of life. And let’s not forget that the Internet grew out of a technology physicists developed to help communicate with each other.

Continue reading “Pure scientific research pays for itself”

The formatting of Nature, Cell and Science papers improves their readability

My favourite aspect of a Nature paper is the figure captions. Not the paper’s innovative science. Not the paper’s succinct length. The figure captions. Why? Because the journal’s simple act of bolding the first sentence of a figure caption can force authors to clarify the purpose of the figure. This is one of several seemingly minor formatting issues that ultimately improves a paper’s readibility.

Continue reading “The formatting of Nature, Cell and Science papers improves their readability”

Scientific conclusions: a more journalistic approach

Conclude your science. Don’t summarise it.

A summary that merely repeats previous material is prohibited for the journal Nature and would be be edited out. Other journals are less strict, but perhaps they should follow Nature’s lead and recommend instead that the conclusion offer something new to the reader. This is often easier said than done. Scientists default toward endings that are typically cliche, uncompelling, or just tail off. Let’s look to factual but more expressive forms of writing, such as long-form journalism and narrative non-fiction, for examples of better endings that could be applied to scientific papers and talks.

Journalists arguably have a little more freedom than scientists in how they word the ending of a piece. A memorable quote or a clever joke, perfect fodder for a popular article, would be out of place in a scientific article. Yet there are several forms of conclusion that we could borrow from journalists to provide a more engaging ending. I’ll borrow my examples primarily from The Atlantic, but any decent popular publication can help.

Continue reading “Scientific conclusions: a more journalistic approach”

What does scientific genius look like in the 21st century?

The names we typically associate with scientific genius are from several centuries or millennia ago. Think Newton, Einstein, Archimedes, Galileo, or Darwin. Even famed scientists that are modern by comparison (Richard Feynman, Francis Crick, or Linus Pauling) made discoveries many decades ago. Just as any sports fan will tell you it is pointless to compare athletes from different eras, the same is true, if not more so, for scientists. Whereas athletes are largely playing the same game as they were decades ago, science has changed. We aim to always answer new questions, address ever more complex and interdisciplinary issues, and occasionally develop experiments costing billions of dollars. How, then, does scientific genius manifest in the 21st century? Which circumstances are most conducive to developing scientific genius? And what traits does a genius in the modern scientific realm exhibit?

Continue reading “What does scientific genius look like in the 21st century?”

Benefits of avoiding replication studies

The benefits of replication studies in science seem obvious and intuitive. Yet they are not particularly prevalent nor encouraged. The typical reasoning is that there’s no value for being the second scientist or group to observe a result. Some1 take this to suggest that the current scientific publishing system is flawed and promotes papers with provocative results rather than technically sound methods. Journals like PLOS One that disregard perceived importance are the exception. There are, however, a number of advantages of the status quo.

Continue reading “Benefits of avoiding replication studies”