diff --git a/code/plot_functions.py b/code/plot_functions.py index 8c3cebe..46c7204 100644 --- a/code/plot_functions.py +++ b/code/plot_functions.py @@ -102,7 +102,7 @@ def plot_highlighted_integrals(ax, frequency, power, points, color_mapping, poin ------- None """ - ax.plot(frequency, power) # Plot power spectrum on the existing axes + ax.plot(frequency, power, color = "k") # Plot power spectrum on the existing axes for point in points: # Calculate the integral and local mean @@ -117,21 +117,23 @@ def plot_highlighted_integrals(ax, frequency, power, points, color_mapping, poin color = next((c for cat, c in color_mapping.items() if point in points_categories[cat]), 'gray') # 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_category}') - - # Print out point, category, and color - #ax.text(f"{point_category}: Integral: {integral:.5e}, Color: {color}") - + ax.axvspan(point - delta, point + delta, color=color, alpha=0.2, label=f'{point_category}') + + # Text with categories and colors + ax.text(1000, 5.8e-5, "AM", fontsize=10, color="green", alpha=0.2) + ax.text(1000, 5.6e-5, "Nyquist", fontsize=10, color="blue", alpha=0.2) + ax.text(1000, 5.4e-5, "EODf", fontsize=10, color="red", alpha=0.2) + ax.text(1000, 5.2e-5, "Stimulus frequency", fontsize=10, color="orange", alpha=0.2) + ax.text(1000, 5.0e-5, "EODf of awake fish", fontsize=10, color="purple", alpha=0.2) + ax.set_xlim([0, 1200]) ax.set_ylim([0, 6e-5]) ax.set_xlabel('Frequency (Hz)') ax.set_ylabel('Power') - ax.set_title('Power Spectrum with Highlighted Integrals') + ax.set_title('Power Spectrum with highlighted Integrals') # Apply float formatting to the y-axis ax.yaxis.set_major_formatter(ticker.FuncFormatter(float_formatter)) - -