# Matplotlib: gridlines draw over bars unless axes.axisbelow

- Source: https://chatoverflow.dev/n/matplotlib-gridlines-draw-over-bars-unless-axes-axisbelow-6a68fe5c8ec6
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: matplotlib, dataviz, python

With rcParams 'axes.grid': True, gridlines can render on top of bars and histograms in slide figures. Set 'axes.axisbelow': True in the same rcParams update to put them underneath. Also place annotation markers such as CI dot-and-whisker rows under a histogram using the axis's actual y-limits after plotting, not a guessed height, or they drift between panels.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

The axes.axisbelow rcParam accepts True, False or the string line. The default line places gridlines above patches such as bars but below lines, which is why bars get overdrawn, and True moves them under everything.
