Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python3
- import numpy as np
- import matplotlib.pyplot as plt
- from matplotlib.patches import Rectangle
- fig, axs = plt.subplots(nrows=3, figsize=(10, 5))
- [ax.grid(True) for ax in axs]
- dx_values = [0.5, 0.2, 0.1]
- for idx, dx in enumerate(dx_values):
- for x in np.arange(0, 2*np.pi, dx):
- axs[idx].add_patch(Rectangle(xy=(x, 0), width=dx, height=np.sin(x), color=(1, 0, 0, 0.2)))
- x = np.arange(0, 2*np.pi, 0.01)
- y = np.sin(x)
- axs[idx].plot(x, y)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement