mplstereonet

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

mplstereonet - Stereonets for Matplotlib

mplstereonet - 基于Matplotlib的赤平投影工具

Quick Reference

快速参考

python
import mplstereonet
import matplotlib.pyplot as plt
python
import mplstereonet
import matplotlib.pyplot as plt

Create stereonet

创建赤平投影图

fig, ax = mplstereonet.subplots()
fig, ax = mplstereonet.subplots()

Plot plane and pole (strike/dip, right-hand rule)

绘制平面及极点(走向/倾角,右手定则)

ax.plane(315, 45, 'b-') # Great circle ax.pole(315, 45, 'ko') # Pole to plane
ax.plane(315, 45, 'b-') # 大圆 ax.pole(315, 45, 'ko') # 平面极点

Plot lineation (trend/plunge)

绘制线理(走向/倾伏)

ax.line(120, 30, 'r^')
ax.grid() plt.savefig('stereonet.png', dpi=150)
undefined
ax.line(120, 30, 'r^')
ax.grid() plt.savefig('stereonet.png', dpi=150)
undefined

Key Functions

核心函数

FunctionPurpose
mplstereonet.subplots()
Create stereonet figure and axes
ax.plane(strike, dip)
Plot great circle
ax.pole(strike, dip)
Plot pole to plane
ax.line(trend, plunge)
Plot lineation point
ax.density_contourf()
Filled density contours
mplstereonet.fit_girdle()
Best-fit great circle
mplstereonet.find_mean_vector()
Mean orientation
函数用途
mplstereonet.subplots()
创建赤平投影图的画布和坐标轴
ax.plane(strike, dip)
绘制大圆
ax.pole(strike, dip)
绘制平面极点
ax.line(trend, plunge)
绘制线理点
ax.density_contourf()
填充式密度等值线
mplstereonet.fit_girdle()
拟合最优大圆
mplstereonet.find_mean_vector()
计算平均方位

Essential Operations

关键操作

Multiple Measurements with Contours

多组测量数据与等值线

python
import numpy as np

strikes = [45, 52, 38, 48, 55, 41, 50, 43]
dips = [25, 30, 22, 28, 35, 24, 32, 27]

fig, ax = mplstereonet.subplots()
python
import numpy as np

strikes = [45, 52, 38, 48, 55, 41, 50, 43]
dips = [25, 30, 22, 28, 35, 24, 32, 27]

fig, ax = mplstereonet.subplots()

Density contour of poles

极点密度等值线

ax.density_contourf(strikes, dips, measurement='poles', cmap='Reds') ax.pole(strikes, dips, 'k.', markersize=5)
ax.grid() ax.set_title('Bedding Orientations') plt.savefig('density.png', dpi=150)
undefined
ax.density_contourf(strikes, dips, measurement='poles', cmap='Reds') ax.pole(strikes, dips, 'k.', markersize=5)
ax.grid() ax.set_title('层理方位') plt.savefig('density.png', dpi=150)
undefined

Calculate Mean Orientation

计算平均方位

python
undefined
python
undefined

Fit best-fit plane (girdle)

拟合最优平面(环带)

mean_strike, mean_dip = mplstereonet.fit_girdle(strikes, dips)
mean_strike, mean_dip = mplstereonet.fit_girdle(strikes, dips)

Or calculate mean pole for clustered data

或为聚类数据计算平均极点

lon, lat = mplstereonet.pole(strikes, dips) mean_lon, mean_lat = mplstereonet.find_mean_vector(lon, lat) mean_s, mean_d = mplstereonet.pole2strike(mean_lon, mean_lat)
undefined
lon, lat = mplstereonet.pole(strikes, dips) mean_lon, mean_lat = mplstereonet.find_mean_vector(lon, lat) mean_s, mean_d = mplstereonet.pole2strike(mean_lon, mean_lat)
undefined

Pi-Diagram (Fold Axis)

π图(褶皱轴分析)

python
undefined
python
undefined

Bedding measurements around a fold

褶皱周围的层理测量数据

strikes = np.array([20, 35, 50, 70, 90, 110, 130, 150, 165, 180]) dips = np.array([45, 40, 35, 30, 25, 30, 35, 40, 45, 50])
fig, ax = mplstereonet.subplots() ax.pole(strikes, dips, 'ko', markersize=6)
strikes = np.array([20, 35, 50, 70, 90, 110, 130, 150, 165, 180]) dips = np.array([45, 40, 35, 30, 25, 30, 35, 40, 45, 50])
fig, ax = mplstereonet.subplots() ax.pole(strikes, dips, 'ko', markersize=6)

Fit girdle to poles - fold axis is pole to girdle

为极点拟合环带——褶皱轴为环带的极点

girdle_strike, girdle_dip = mplstereonet.fit_girdle(strikes, dips) ax.plane(girdle_strike, girdle_dip, 'r-', linewidth=2)
fold_trend, fold_plunge = mplstereonet.pole(girdle_strike, girdle_dip) ax.line(fold_trend, fold_plunge, 'r^', markersize=12, label='Fold axis')
ax.grid() ax.legend()
undefined
girdle_strike, girdle_dip = mplstereonet.fit_girdle(strikes, dips) ax.plane(girdle_strike, girdle_dip, 'r-', linewidth=2)
fold_trend, fold_plunge = mplstereonet.pole(girdle_strike, girdle_dip) ax.line(fold_trend, fold_plunge, 'r^', markersize=12, label='褶皱轴')
ax.grid() ax.legend()
undefined

Fault Plane with Slip Vector

含滑动矢量的断层面

python
fault_strike, fault_dip = 45, 60
rake = 30  # Degrees from strike
python
fault_strike, fault_dip = 45, 60
rake = 30  # 与走向的夹角(度)

Convert rake to trend/plunge

将 rake 转换为走向/倾伏

slip_trend, slip_plunge = mplstereonet.rake(fault_strike, fault_dip, rake)
fig, ax = mplstereonet.subplots() ax.plane(fault_strike, fault_dip, 'r-', linewidth=2) ax.line(slip_trend, slip_plunge, 'r>', markersize=10) ax.grid()
undefined
slip_trend, slip_plunge = mplstereonet.rake(fault_strike, fault_dip, rake)
fig, ax = mplstereonet.subplots() ax.plane(fault_strike, fault_dip, 'r-', linewidth=2) ax.line(slip_trend, slip_plunge, 'r>', markersize=10) ax.grid()
undefined

Multiple Joint Sets

多组节理

python
set1 = {'strikes': [45, 50, 42, 48], 'dips': [70, 75, 68, 72]}
set2 = {'strikes': [135, 140, 130, 138], 'dips': [60, 65, 58, 62]}

fig, ax = mplstereonet.subplots()
ax.pole(set1['strikes'], set1['dips'], 'ro', label='Set 1')
ax.pole(set2['strikes'], set2['dips'], 'bs', label='Set 2')
ax.grid()
ax.legend()
python
set1 = {'strikes': [45, 50, 42, 48], 'dips': [70, 75, 68, 72]}
set2 = {'strikes': [135, 140, 130, 138], 'dips': [60, 65, 58, 62]}

fig, ax = mplstereonet.subplots()
ax.pole(set1['strikes'], set1['dips'], 'ro', label='组1')
ax.pole(set2['strikes'], set2['dips'], 'bs', label='组2')
ax.grid()
ax.legend()

Measurement Conventions

测量约定

FormatDescriptionExample
Strike/DipRight-hand rule (dip to right of strike)045/60
Dip Direction/DipAzimuth of dip direction135/60
Trend/PlungeLinear orientation180/30
格式说明示例
走向/倾角右手定则(倾角指向走向右侧)045/60
倾向/倾角倾向的方位角135/60
走向/倾伏线性方位180/30

Format Conversions

格式转换

python
undefined
python
undefined

Strike/dip to dip direction

走向/倾角转倾向

strike, dip = 45, 60 dip_direction = (strike + 90) % 360
strike, dip = 45, 60 dip_direction = (strike + 90) % 360

Pole to strike/dip

极点转走向/倾角

lon, lat = mplstereonet.pole(strike, dip) back_strike, back_dip = mplstereonet.pole2strike(lon, lat)
undefined
lon, lat = mplstereonet.pole(strike, dip) back_strike, back_dip = mplstereonet.pole2strike(lon, lat)
undefined

Contouring Methods

等值线绘制方法

MethodDescription
kamb
Statistical significance (default)
schmidt
Point counting
exponential_kamb
Smoothed Kamb
方法说明
kamb
统计显著性(默认)
schmidt
点计数法
exponential_kamb
平滑Kamb法

When to Use vs Alternatives

适用场景与替代工具对比

ToolBest ForLimitations
mplstereonetQuick stereonets in Python, matplotlib integration, scripted workflowsNo interactive rotation, limited 3D
apsgAdvanced structural analysis, tensors, orientation statisticsSteeper learning curve
JTOPOInteractive GUI exploration, teachingJava-based, not scriptable
Use mplstereonet when you need programmatic stereonet generation integrated with matplotlib, batch processing of orientation datasets, or reproducible structural plots for publications.
Consider alternatives when you need interactive 3D visualization of orientations (use apsg), a GUI for teaching or quick inspection (use JTOPO), or advanced tensor statistics beyond what mplstereonet provides.
工具最佳用途局限性
mplstereonetPython环境下快速生成赤平投影图、与matplotlib集成、脚本化工作流无交互式旋转、3D功能有限
apsg高级构造分析、张量计算、方位统计学习曲线较陡
JTOPO交互式GUI探索、教学用途基于Java、不支持脚本化
当你需要通过编程方式生成与matplotlib集成的赤平投影图、批量处理方位数据集,或为学术出版物生成可复现的构造图时,使用mplstereonet。
考虑替代工具的场景:需要方位数据的交互式3D可视化(使用apsg)、用于教学或快速查看的GUI(使用JTOPO),或mplstereonet未提供的高级张量统计功能。

Common Workflows

常见工作流程

Analyze bedding orientations and determine fold axis

分析层理方位并确定褶皱轴

  • Load strike/dip measurements from CSV or array
  • Create stereonet with
    mplstereonet.subplots()
  • Plot poles to bedding with
    ax.pole(strikes, dips)
  • Generate density contours with
    ax.density_contourf()
  • Fit girdle to poles with
    mplstereonet.fit_girdle()
  • Calculate fold axis as pole to girdle with
    mplstereonet.pole()
  • Plot fold axis with
    ax.line(trend, plunge)
  • Add grid, legend, and save figure
  • 从CSV或数组加载走向/倾角测量数据
  • 使用
    mplstereonet.subplots()
    创建赤平投影图
  • 使用
    ax.pole(strikes, dips)
    绘制层理极点
  • 使用
    ax.density_contourf()
    生成密度等值线
  • 使用
    mplstereonet.fit_girdle()
    为极点拟合环带
  • 使用
    mplstereonet.pole()
    计算环带的极点作为褶皱轴
  • 使用
    ax.line(trend, plunge)
    绘制褶皱轴
  • 添加网格、图例并保存图像

References

参考资料

  • Projection Types - Equal-area vs equal-angle projections
  • Plotting Options - Customization and styling
  • 投影类型 - 等面积投影 vs 等角投影
  • 绘图选项 - 自定义与样式设置

Scripts

脚本

  • scripts/structural_analysis.py - Analyze structural data and generate plots
  • scripts/structural_analysis.py - 分析构造数据并生成图像