mplstereonet
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesemplstereonet - Stereonets for Matplotlib
mplstereonet - 基于Matplotlib的赤平投影工具
Quick Reference
快速参考
python
import mplstereonet
import matplotlib.pyplot as pltpython
import mplstereonet
import matplotlib.pyplot as pltCreate 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)
undefinedax.line(120, 30, 'r^')
ax.grid()
plt.savefig('stereonet.png', dpi=150)
undefinedKey Functions
核心函数
| Function | Purpose |
|---|---|
| Create stereonet figure and axes |
| Plot great circle |
| Plot pole to plane |
| Plot lineation point |
| Filled density contours |
| Best-fit great circle |
| Mean orientation |
| 函数 | 用途 |
|---|---|
| 创建赤平投影图的画布和坐标轴 |
| 绘制大圆 |
| 绘制平面极点 |
| 绘制线理点 |
| 填充式密度等值线 |
| 拟合最优大圆 |
| 计算平均方位 |
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)
undefinedax.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)
undefinedCalculate Mean Orientation
计算平均方位
python
undefinedpython
undefinedFit 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)
undefinedlon, 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)
undefinedPi-Diagram (Fold Axis)
π图(褶皱轴分析)
python
undefinedpython
undefinedBedding 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()
undefinedgirdle_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()
undefinedFault Plane with Slip Vector
含滑动矢量的断层面
python
fault_strike, fault_dip = 45, 60
rake = 30 # Degrees from strikepython
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()
undefinedslip_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()
undefinedMultiple 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
测量约定
| Format | Description | Example |
|---|---|---|
| Strike/Dip | Right-hand rule (dip to right of strike) | 045/60 |
| Dip Direction/Dip | Azimuth of dip direction | 135/60 |
| Trend/Plunge | Linear orientation | 180/30 |
| 格式 | 说明 | 示例 |
|---|---|---|
| 走向/倾角 | 右手定则(倾角指向走向右侧) | 045/60 |
| 倾向/倾角 | 倾向的方位角 | 135/60 |
| 走向/倾伏 | 线性方位 | 180/30 |
Format Conversions
格式转换
python
undefinedpython
undefinedStrike/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)
undefinedlon, lat = mplstereonet.pole(strike, dip)
back_strike, back_dip = mplstereonet.pole2strike(lon, lat)
undefinedContouring Methods
等值线绘制方法
| Method | Description |
|---|---|
| Statistical significance (default) |
| Point counting |
| Smoothed Kamb |
| 方法 | 说明 |
|---|---|
| 统计显著性(默认) |
| 点计数法 |
| 平滑Kamb法 |
When to Use vs Alternatives
适用场景与替代工具对比
| Tool | Best For | Limitations |
|---|---|---|
| mplstereonet | Quick stereonets in Python, matplotlib integration, scripted workflows | No interactive rotation, limited 3D |
| apsg | Advanced structural analysis, tensors, orientation statistics | Steeper learning curve |
| JTOPO | Interactive GUI exploration, teaching | Java-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.
| 工具 | 最佳用途 | 局限性 |
|---|---|---|
| mplstereonet | Python环境下快速生成赤平投影图、与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 - 分析构造数据并生成图像