Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add grid lines in just one axis using a matplotlibrc file

I am trying to define a style in a matplotlibrc file which only shows grids on the y axis. If I do the following

axis.grid: True

both, the x and y axis will have grid.Is there a way of doing something like:

axis.Yaxis: True

I did not find anything like that in the documentation.

I am using Python 3.4

like image 737
Andres Cala Avatar asked Dec 05 '25 20:12

Andres Cala


1 Answers

There is no rc parameter to change the grid on each axis individually. However you may turn only activate it for one specific axes

Options are to set the grid on globally and turn it off for the x axis

plt.rcParams["axes.grid"] =True
plt.rcParams["axes.grid.axis"] ="y"

or in the matplotlib rc file:

axes.grid.axis : y
axes.grid : True
like image 125
ImportanceOfBeingErnest Avatar answered Dec 08 '25 09:12

ImportanceOfBeingErnest



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!