import numpy as np
import matplotlib.pyplot as plt
# Configurable parameters
a = 2.2 # change this to adjust the width: f(x) = exp(-0.5 * a^2 * x^2)
xmin, xmax = -4, 4
ymin, ymax = 0, 1.05 # fixed y-axis limits; adjust if needed
n_points = 1000
background_color = '#FFFF99'
foreground_color = '#000000'
# Data
x = np.linspace(xmin, xmax, n_points)
y = np.exp(-0.5 * (a**2) * x**2)
# Legend text (LaTeX-style)
legend_text = rf"$f(x)=e^{{-\frac{{1}}{{2}} a^2 x^2}},\ a={a}$"
# Plot
fig, ax = plt.subplots(figsize=(12, 7), facecolor=background_color)
ax.plot(x, y, color='darkblue', linewidth=3, label=legend_text)
ax.axvline(0, color='red', linestyle='--', alpha=0.8) # center line at x=0
# Styling: no axis labels, fixed axes
ax.set_xlabel('')
ax.set_ylabel('')
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
ax.set_facecolor(background_color)
ax.grid(True, linestyle=':', alpha=0.7, color='#AAAAAA')
ax.tick_params(axis='both', colors=foreground_color)
# Legend with white background box
ax.legend(facecolor='white', edgecolor='gray', loc='upper right', fontsize=12)
plt.show()