fig = plt.figure(figsize=(8, 6))
ax1 = fig.add_subplot(111)
ax2 = ax1.twinx()
ax1.grid(axis='both', color='black')
ax1.bar(x, y1, 1, alpha=0.9, edgecolor='black', facecolor='blue', zorder=1)
ax2.grid(axis='y', color='green')
ax2.plot(x + 0.5, y2, color='red')
plt.show()
Matplotlib: grid lines above bars