Histograms are very sensitive to the number of bins used. Kernel density plots give a smoother and more accurate picture of the distribution. Usually, we overlay a density plot on a histogram using the `density()` function to visualize data distribution.

If invoked by itself, the `density()` function only produces the density plot. To overlay it on the histogram, we use the `lines()` function, which does not erase the current chart and instead overlays the existing plot. Since the density plot plots relative frequencies (approximating a probability density function), we need to ensure that the histogram also shows the relative frequencies. The `prob=TRUE` argument achieves this:

hist(mpg, prob=TRUE) lines(density(mpg)) ...