To add only horizontal gridlines (y-axis gridlines), pass axis='y' as an argument to the matplotlib.pyplot.grid() function.