Drawing histograms
Recall that histograms cut up a continuous variable into discrete bins and, by default, maps the internally calculated count variable (the number of observations in each bin) onto the y aesthetic. An internal variable called density can be accessed by using the .. notation, i.e. ..density... Plotting this variable will show the relative frequency, which is the height times the width of each bin.
Questo esercizio fa parte del corso
Introduction to Data Visualization with ggplot2
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Plot mpg
___ +
# Add a histogram layer
___