Changed my plot function

This commit is contained in:
Diana 2024-10-24 10:25:26 +02:00
parent b0d5d5ccfb
commit 89b1254425

View File

@ -110,11 +110,14 @@ def plot_highlighted_integrals(frequency, power, points, color_mapping, points_c
# Define color based on the category of the point
color = next((c for cat, c in color_mapping.items() if point in points_categories[cat]), 'gray')
# Find the category of the point
point_category = next((cat for cat, pts in points_categories.items() if point in pts), "Unknown")
# Shade the region around the point where the integral was calculated
ax.axvspan(point - delta, point + delta, color=color, alpha=0.3, label=f'{point:.2f} Hz')
# Print out point and color
print(f"{points_categories}: {integral:.5e}, Color: {color}")
# Print out point, category, and color
print(f"{point_category}: Integral: {integral:.5e}, Color: {color}")
# Annotate the plot with the point and its color
ax.text(point, max(power) * 0.9, f'{point:.2f}', color=color, fontsize=10, ha='center')