Exerciseschevron_rightChapter 5chevron_right5.6
fitness_center

Exercise 5.6

Porosity-Permeability Crossplot

Level 2
Chapter 5: Data Visualization & Plotting
descriptionProblem

A porosity-permeability crossplot is the most-printed petrophysical chart in the world. Each plug is a dot; permeability lives on a log scale because it spans orders of magnitude even within one zone.

The starter gives you 60 core plugs split across two zones with different rock-quality:

  • Zone A: clean sandstone (higher porosity, much higher perm)
  • Zone B: silty sandstone (lower porosity, more tortuous flow)

Build the crossplot:

  1. ax.scatter the points with two colours (one per zone) and a

label for each so the legend identifies them.

  1. Log y-axis for permeability (ax.set_yscale("log")).
  2. Axis labels ("Porosity (v/v)", "Permeability (mD)"), title,

legend, light grid.

lightbulbHints (0/3)

Stuck? Reveal hints one at a time — they progress from nudge to near-solution.

codeYour solution
main.py
visibilityReveal reference solutionexpand_more

Try solving it yourself first — the hints walk you through it. The solution below is one valid approach; yours may differ and still be correct.

import numpy as np
import matplotlib.pyplot as plt

np.random.seed(13)
phi_a  = np.random.normal(0.22, 0.03, 30)
perm_a = 10 ** np.random.normal(2.3, 0.35, 30)
phi_b  = np.random.normal(0.13, 0.03, 30)
perm_b = 10 ** np.random.normal(0.7, 0.35, 30)

fig, ax = plt.subplots(figsize=(6, 5))
ax.scatter(phi_a, perm_a, color="#2E8B57", alpha=0.75, label="Zone A - clean sandstone")
ax.scatter(phi_b, perm_b, color="#CC4444", alpha=0.75, label="Zone B - silty sandstone")

ax.set_yscale("log")
ax.set_xlabel("Porosity (v/v)")
ax.set_ylabel("Permeability (mD)")
ax.set_title("Porosity-Permeability crossplot")
ax.grid(True, which="both", alpha=0.25)
ax.legend()
plt.tight_layout()
plt.show()

lockCopying code is a Full Access feature.