diff --git a/app.R b/app.R index 5157644..dc42457 100644 --- a/app.R +++ b/app.R @@ -122,15 +122,17 @@ server <- function(input, output, session) output$plot_ghm <- renderPlot({ data_ghm() %>% - count(GHM) %>% - top_n(10) %>% - arrange(n) %>% - mutate(GHM = GHM %>% factor(levels = GHM)) %>% + count(GHM, Sexe) %>% + semi_join(GHM %>% count(GHM) %>% top_n(10) %>% arrange(n), by = "GHM") %>% + ungroup %>% + mutate(GHM = GHM %>% factor(levels = GHM %>% unique)) %>% ggplot() + - aes(x = GHM, y = n) + + aes(x = GHM, y = n, fill = Sexe) + geom_bar(stat = "identity") + + scale_fill_manual(values = c("Homme" = "lightblue", "Femme" = "pink")) + coord_flip() + - theme(axis.title = element_blank()) + theme(axis.title = element_blank(), + legend.position = "none") }) # Sexe