BaşlayınÜcretsiz Başlayın

Adjusting the bin numbers

Let's take our first steps away from the default number of bins with our histograms. We'll start by building a histogram of the percentage of the speed a driver is traveling over the limit for each citation. This is calculated as ((speed - speed_limit) / speed_limit)*100.

Plot percentage over the speed limit as a histogram with the number of bins set to 40. While you're at it, set the alpha to 0.8. You're entirely on your own with this one, no scaffolding.

Bu egzersiz

Visualization Best Practices in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Load md_speeding into ggplot() object.
  • Add a histogram geometry to plot.
  • Set x aes()thetic to percentage_over_limit.
  • Adjust settings for 40 bins and set alpha as 0.8.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Load md_speeding into ggplot
___ +
  # add a geom_histogram with x mapped to percentage_over_limit
    ___(
        ___
        ___     # set bin number to 40
        ___)    # reduce alpha to 0.8
Kodu Düzenle ve Çalıştır