Skip to content

Commit 63bd886

Browse files
committed
fixed hline bug in plot spectrum
1 parent 68d2364 commit 63bd886

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/axiomatic/pic_helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def plot_single_spectrum(
9797
) # Add vertical line
9898
for y_val in hlines:
9999
plt.axhline(
100-
x=y_val, color="red", linestyle="--", label=f"Transmission (y={y_val})"
100+
y=y_val, color="red", linestyle="--", label=f"Transmission (y={y_val})"
101101
) # Add vertical line
102102
return plt.gcf()
103103

@@ -141,6 +141,8 @@ def plot_interactive_spectra(
141141
# Calculate global y-limits across all arrays
142142
y_min = min(min(min(arr2) for arr2 in arr1) for arr1 in spectra)
143143
y_max = max(max(max(arr2) for arr2 in arr1) for arr1 in spectra)
144+
y_min = min(hlines + [y_min])*0.95
145+
y_max = max(hlines + [y_max])*1.05
144146

145147
slider_index = slider_index or list(range(len(spectra[0])))
146148
spectrum_labels = spectrum_labels or [f"Spectrum {i}" for i in range(len(spectra))]
@@ -159,7 +161,7 @@ def plot_array(index=0):
159161
) # Add vertical line
160162
for y_val in hlines:
161163
plt.axhline(
162-
x=y_val, color="red", linestyle="--", label=f"Transmission (y={y_val})"
164+
y=y_val, color="red", linestyle="--", label=f"Transmission (y={y_val})"
163165
) # Add vertical line
164166
plt.title(f"Iteration: {index}")
165167
plt.xlabel("X")

0 commit comments

Comments
 (0)