Subsurface Syntax

Subsurface Syntax

Displaying Lithology Data Using Python and matplotlib

Using fill_betweenx() in matplotlib to add variable color fills and hatches for geological lithology data

Andy McDonald's avatar
Andy McDonald
Feb 07, 2021
∙ Paid

Using fill_betweenx() in matplotlib to add variable color fills and hatches for geological lithology data

Well log plot with gamma ray, neutron porosity and bulk density data plotted alongside lithology data.
Well log plot with gamma ray, neutron porosity and bulk density data plotted alongside lithology data. Image created by the author.

Adding lithology information to a well log plot can enhance a petrophysical or geological interpretation. It can be used to understand why some log responses may behave the way they do. This data may have been sourced from a previous mineralogical interpretation or from mud logs.

In my previous article: Enhancing Visualization of Well Logs With Plot Fills, we saw: how to apply fixed color fill between a curve and the edge of a track, how to apply a density-neutron crossover fill and how to apply a variable fill based upon the value of curve being plotted.

In this article will cover how to use a variable fill to apply not only a color to our plot, but also a hatching. Using these two options allows us to generate lithological fill.

This article forms part o…

Keep reading with a 7-day free trial

Subscribe to Subsurface Syntax to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2026 Andy McDonald · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture