You can also adjust grids in a histogram. We almost always remove the categorical axis grid for other charts, but here we have a numerical variable presented on the horizontal axis. Do we have to keep the grid? You can if you think it's necessary. However, your chart will be less cluttered if you decide to remove it. (We're not giving you hard and fast rules here, just suggestions.) After adding borders to the bars, we can see where each bar starts and ends, so we don't need the grid to read specific intervals.
So how do we remove this grid? It's very like how we removed it from the bar chart. The difference is that the numerical axis grid in
ggplot consists of two types of lines: major lines (which are usually thicker) and minor lines (which lie between the major lines). We have to remove each line type separately from the chart. We do this by adding this command:
+theme(panel.grid.major.x = element_blank(), panel.grid.minor.x = element_blank())
element_blank() will remove the major grid lines from the horizontal axis, and setting
element_blank() will remove the minor ones.