library(ggplot2)
ggplot(gtsummary::trial) +
  aes(x = stage) +
  geom_bar()

library(ggplot2)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    fill = grade 
  ) +
  geom_bar()

library(ggplot2)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    fill = grade, 
  ) +
  geom_bar(
    position = position_dodge(.9)
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop)),
    stat = "prop"
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop)),
    stat = "prop", 
    position = position_dodge(.9)
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop)),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent)

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer()

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light()

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("")

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("") +
  labs(fill = "")

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("") +
  labs(fill = "") +
  ggtitle("Distribution selon le niveau, par grade")

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("") +
  labs(fill = "") +
  ggtitle("Distribution selon le niveau, par grade") +
  theme(
    legend.position = "top"
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("") +
  labs(fill = "") +
  ggtitle("Distribution selon le niveau, par grade") +
  theme(
    legend.position = "top",
    panel.grid = element_blank()
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("") +
  labs(fill = "") +
  ggtitle("Distribution selon le niveau, par grade") +
  theme(
    legend.position = "top",
    panel.grid = element_blank(),
    panel.border = element_blank()
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("") +
  labs(fill = "") +
  ggtitle("Distribution selon le niveau, par grade") +
  theme(
    legend.position = "top",
    panel.grid = element_blank(),
    panel.border = element_blank(),
    axis.text.y = element_blank()
  )

library(ggplot2)
library(ggstats)
ggplot(gtsummary::trial) +
  aes(
    x = stage,
    y = after_stat(prop),
    fill = grade, 
    by = grade,
    label = scales::percent(after_stat(prop), accuracy = 1)
  ) +
  geom_bar(
    stat = "prop", 
    position = position_dodge(.9)
  ) +
  geom_text(
    aes(y = after_stat(prop) - 0.01),
    stat = "prop", 
    position = position_dodge(.9),
    vjust = "top"
  ) +
  scale_y_continuous(labels = scales::percent) + 
  scale_fill_brewer() +
  theme_light() +
  xlab("") +
  ylab("") +
  labs(fill = "") +
  ggtitle("Distribution selon le niveau, par grade") +
  theme(
    legend.position = "top",
    panel.grid = element_blank(),
    panel.border = element_blank(),
    axis.text.y = element_blank(),
    axis.ticks = element_blank()
  )