Skip to content Skip to sidebar Skip to footer

Python Matplotlib Style File: Show Only Horizontal Gridlines

I'm trying to define a matplotlib style file (.mplstyle) to only show horizontal gridlines. I know I can do it in python with fig, ax = plt.subplots() ax.yaxis.grid(True) but I

Solution 1:

You need to turn the grid on as well,

import matplotlib.pyplot as plt
plt.rcParams["axes.grid.axis"] ="y"
plt.rcParams["axes.grid"] = True

or in the matplotlibrc file:

axes.grid.axis :yaxes.grid :True

Post a Comment for "Python Matplotlib Style File: Show Only Horizontal Gridlines"