data("hdv2003", package = "questionr")
library(ggplot2)
ggplot(hdv2003) +
  aes(x = occup) +
  geom_bar()

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = occup, y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop")

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = occup, y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop") +
  scale_y_continuous(labels = scales::label_percent())

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop") +
  scale_y_continuous(labels = scales::label_percent())

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop"
  ) +
  scale_y_continuous(labels = scales::label_percent())

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop",
    nudge_y = .02
  ) +
  scale_y_continuous(labels = scales::label_percent())

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop", 
           fill = "#4477AA", colour = "black") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop",
    nudge_y = .02
  ) +
  scale_y_continuous(labels = scales::label_percent())

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop", 
           fill = "#4477AA", colour = "black") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop",
    nudge_y = .02
  ) +
  scale_y_continuous(labels = scales::label_percent()) +
  theme_minimal()

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop", 
           fill = "#4477AA", colour = "black") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop",
    nudge_y = .02
  ) +
  scale_y_continuous(labels = scales::label_percent()) +
  theme_minimal() +
  theme(
    panel.grid = element_blank()
  )

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop", 
           fill = "#4477AA", colour = "black") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop",
    nudge_y = .02
  ) +
  theme_minimal() +
  theme(
    panel.grid = element_blank(),
    axis.text.y = element_blank()
  )

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop", 
           fill = "#4477AA", colour = "black") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop",
    nudge_y = .02
  ) +
  theme_minimal() +
  theme(
    panel.grid = element_blank(),
    axis.text.y = element_blank()
  ) +
  xlab(NULL) + ylab(NULL)

data("hdv2003", package = "questionr")
library(ggplot2)
library(ggstats)
ggplot(hdv2003) +
  aes(x = forcats::fct_infreq(occup), 
      y = after_stat(prop), by = 1) +
  geom_bar(stat = "prop", 
           fill = "#4477AA", colour = "black") +
  geom_text(
    aes(label = after_stat(prop) |> 
          scales::percent(accuracy = .1)),
    stat = "prop",
    nudge_y = .02
  ) +
  theme_minimal() +
  theme(
    panel.grid = element_blank(),
    axis.text.y = element_blank()
  ) +
  xlab(NULL) + ylab(NULL) +
  ggtitle("Occupation des personnes enquêtées")