Exercises for Matplotlib
Solution:
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(1, 1, figsize=(5, 4))
x = np.linspace(0, 2, 1000)
y = np.power(np.sin(x-2), 2) * np.power(np.e, -np.power(x, 2))
# y = (np.sin(x-2) ** 2) * (np.e ** (-x ** 2))
ax.plot(x, y)
ax.set_xlim((0, 2))
ax