Skip to content

Commit e3651a0

Browse files
fix(matplotlib): address review feedback for stereonet-equal-area
Attempt 1/3 - fixes based on AI review
1 parent 9a7f6b3 commit e3651a0

1 file changed

Lines changed: 34 additions & 10 deletions

File tree

plots/stereonet-equal-area/implementations/matplotlib.py

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" pyplots.ai
1+
"""pyplots.ai
22
stereonet-equal-area: Structural Geology Stereonet (Equal-Area Projection)
33
Library: matplotlib 3.10.8 | Python 3.14.3
44
Quality: 82/100 | Created: 2026-03-15
@@ -23,7 +23,7 @@
2323
all_strikes = np.concatenate([bedding_strike, joint_strike, fault_strike])
2424
all_dips = np.concatenate([bedding_dip, joint_dip, fault_dip])
2525
feature_types = ["Bedding"] * 30 + ["Joint"] * 25 + ["Fault"] * 20
26-
colors = {"Bedding": "#306998", "Joint": "#E8833A", "Fault": "#9B2335"}
26+
colors = {"Bedding": "#306998", "Joint": "#E8833A", "Fault": "#8B2252"}
2727
markers = {"Bedding": "o", "Joint": "s", "Fault": "^"}
2828

2929
# Pole orientations in equal-area (Schmidt) projection
@@ -59,9 +59,10 @@
5959
cos_dist = gx * pole_vx[j] + gy * pole_vy[j] + gz * pole_vz[j]
6060
Z += np.exp(-(np.arccos(np.clip(cos_dist, -1, 1)) ** 2) / (2 * sigma**2))
6161

62-
ax.contourf(THETA, R, Z, levels=8, cmap="Greys", alpha=0.25, zorder=1)
62+
contour_fill = ax.contourf(THETA, R, Z, levels=8, cmap="YlOrBr", alpha=0.3, zorder=1)
63+
ax.contour(THETA, R, Z, levels=8, colors="#B87333", alpha=0.4, linewidths=0.6, zorder=1)
6364

64-
# Great circles for each plane
65+
# Great circles for each plane - increased visibility
6566
t_param = np.linspace(0, np.pi, 180)
6667
for i in range(len(all_strikes)):
6768
alpha = np.deg2rad(all_strikes[i])
@@ -74,7 +75,7 @@
7475
plunge = np.arctan2(pz, horiz)
7576
colat = np.pi / 2 - plunge
7677
r = np.sqrt(2) * np.sin(colat / 2)
77-
ax.plot(trend, r, color=colors[feature_types[i]], alpha=0.15, linewidth=0.7, zorder=2)
78+
ax.plot(trend, r, color=colors[feature_types[i]], alpha=0.35, linewidth=1.2, zorder=2)
7879

7980
# Poles as scatter points with distinct markers per feature type
8081
for feat in colors:
@@ -83,14 +84,26 @@
8384
pole_trend_rad[mask],
8485
pole_r[mask],
8586
c=colors[feat],
86-
s=150,
87+
s=160,
8788
marker=markers[feat],
8889
edgecolors="white",
89-
linewidth=0.8,
90+
linewidth=1.0,
9091
label=f"{feat} poles",
9192
zorder=5,
9293
)
9394

95+
# N label emphasis at top
96+
ax.annotate(
97+
"N",
98+
xy=(0, 1.08),
99+
xycoords="axes fraction",
100+
ha="center",
101+
va="center",
102+
fontsize=24,
103+
fontweight="bold",
104+
color="#333333",
105+
)
106+
94107
# Style
95108
ax.set_rlim(0, 1)
96109
ax.set_rticks([])
@@ -99,7 +112,7 @@
99112
tick_labels = []
100113
for d in theta_ticks:
101114
if d == 0:
102-
tick_labels.append("N")
115+
tick_labels.append("")
103116
elif d == 90:
104117
tick_labels.append("E")
105118
elif d == 180:
@@ -113,10 +126,21 @@
113126
ax.set_xticklabels(tick_labels, fontsize=16)
114127
ax.grid(True, alpha=0.15, linewidth=0.5, color="gray")
115128

129+
# Primitive circle emphasis
130+
circle_theta = np.linspace(0, 2 * np.pi, 200)
131+
ax.plot(circle_theta, np.ones_like(circle_theta), color="#444444", linewidth=1.5, zorder=3)
132+
133+
# Legend inside the plot area for better layout balance
116134
ax.legend(
117-
loc="upper right", bbox_to_anchor=(1.22, 1.05), fontsize=16, framealpha=0.9, edgecolor="none", markerscale=1.2
135+
loc="upper left",
136+
bbox_to_anchor=(0.02, 0.98),
137+
fontsize=16,
138+
framealpha=0.92,
139+
edgecolor="#cccccc",
140+
fancybox=True,
141+
markerscale=1.2,
118142
)
119-
ax.set_title("stereonet-equal-area · matplotlib · pyplots.ai", fontsize=22, fontweight="medium", pad=30)
143+
ax.set_title("stereonet-equal-area · matplotlib · pyplots.ai", fontsize=24, fontweight="medium", pad=35)
120144

121145
plt.tight_layout()
122146
plt.savefig("plot.png", dpi=300, bbox_inches="tight")

0 commit comments

Comments
 (0)