Histogram and density distribution in R by ggplot2

Here is a little inspiration:

set.seed(860867)
my_dat = tibble(obs = c(sample(1:1800, 1000), sample(1:3e6, 100)))

my_dat %>%
  ggplot(aes(x=obs)) +
  geom_histogram() +
  theme_bw()

my_dat %>%
  ggplot(aes(x=obs)) +
  geom_histogram(binwidth = 1e6) +
  theme_bw()

my_dat %>%
  ggplot(aes(x=obs)) +
  geom_histogram() +
  scale_x_continuous(trans="log10") +
  theme_bw()
2 Likes