import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
# Creating a grid of subplots
fig = plt.figure()
# Define a 2x2 grid
gs = GridSpec(2, 2)
# Creating subplots
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1])
ax3 = fig.add_subplot(gs[1, :])
# Plotting some data on the subplots
ax1.plot([1, 2, 3], [4, 5, 6])
ax2.scatter([1, 2, 3], [4, 5, 6])
ax3.bar([1, 2, 3], [4, 5, 6])
# Adding grid to all subplots
for ax in [ax1, ax2, ax3]:
ax.grid(True, linestyle='--', linewidth=0.5, color='gray')
plt.show()