Member-only story
Six Matplotlib Changes That Improve Your Figures for Reporting and Publication
Small adjustments. Large visual difference.
It’s no secret that matplotlib’s defaults are functional, but they don’t always do the data justice! I have talked about this multiple times on here and over on Substack.
You’ll get a chart with the right data, the right axes, and roughly the right shape. But functional and clear aren’t the same thing, and the distance between them is mostly a handful of lines of code and personal choices.
This article covers six of them. They are not clever hacks, instead they are small adjustments that can become automatic once you’ve made them a few times.
The example I am using here is synthetic porosity-permeability scatter for four lithology types: Sand A, Sand B, Shaly Sand, and Tight Zone. Whilst this article is geoscience focused, the same changes can be applied to any chart to take them from matplotlib basic to something that you can easily put in a report.
Setting Up the Basic Matplotlib Plot
The starting point is a plain scatter with no styling decisions at all.
fig, ax = plt.subplots()
for formation, group in df.groupby("Formation"):
ax.scatter(group["Porosity"]…










