Last active
January 12, 2021 13:33
-
-
Save kwinkunks/1736562504c24f79c6c291f19c8a4f4c to your computer and use it in GitHub Desktop.
x lines of Python: Stereonets with mplstereonet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import mplstereonet as mpl | |
# Load the data. | |
df = pd.read_csv("https://raw.githubusercontent.com/ICWallis/fractoolbox/master/testdata-fractures.csv") | |
# Create a stereonet with grid lines. | |
fig, ax = mpl.subplots(figsize=(9, 6)) | |
ax.grid(color='k', alpha=0.2) | |
# Loop over fracture sets and plot each in its own colour. | |
types = {'Cond_FTS': 'red', 'Cond_FTCC': 'blue'} | |
for i, (typ, grp) in enumerate(df.groupby('type')): | |
if typ not in types: continue | |
strike, dip = grp.dipazimuth_deg, grp.dip_deg | |
ax.pole(strike, dip, color=types[typ], markersize=4, alpha=0.5) | |
note = f"{typ}: {dip.size} pts\nMean dip: {dip.mean():.1f}\nMean strike: {strike.mean():.1f}" | |
ax.annotate(note, xy=(5*72, i*45), color=types[typ], xycoords='axes points') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment