Here is a possible way:
library(ggthemes)
library(RColorBrewer)
library(tidyverse)
df %>%
count(Region, ID, name="projectsPerRegion") %>%
ggplot(aes(y = fct_rev(fct_infreq(Region)), x = projectsPerRegion, fill=as.factor(ID),
label = projectsPerRegion))+
geom_col()+
labs(y="Region", x = "N", fill="ID")+
geom_text(size = 3, position = position_stack(vjust = 0.5))+
scale_fill_brewer(palette="Dark2")+
theme_clean()
data:
structure(list(ID = c(3660, 3660, 3660, 3660, 3660, 3660, 3660,
4499, 4499, 4499, 4499, 4499, 4499, 4499, 4499, 4499, 4499, 4499,
4499, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2680, 2680,
2680, 2680, 2684, 2684, 2684, 2684, 2699, 2699, 2699, 2699, 2699
), Institution = c("Kl", "GU", "RSK", "RS", "VS", "RO", "UU",
"Kl", "RO", "RSK", "UU", "GU", "RO", "VG", "LU", "RS", "RU",
"RV", "LU", "LU", "Kl", "RSK", "LaB", "AS", "RS", "BLA", "KTS",
"Kl", "MAB", "RS", "RSK", "DM", "MAb", "SLT", "VG", "UU", "Kl",
"RU", "UU", "LU"), Lat = c(59.43518273, 57.71045289, 56.02491266,
59.43518273, 57.71045289, 58.41060411, 59.85981925, 59.43518273,
58.41060411, 56.02491266, 59.85981925, 57.71045289, 59.27472205,
57.71045289, 58.41060411, 59.43518273, 59.85981925, 63.82660418,
56.02491266, 56.02491266, 59.43518273, 56.02491266, 59.85981925,
56.02491266, 59.43518273, 59.43518273, 59.43518273, 59.43518273,
59.43518273, 59.43518273, 56.02491266, 59.43518273, 59.43518273,
59.43518273, 57.71045289, 59.85981925, 59.43518273, 59.85981925,
63.82660418, 58.41060411), Lon = c("17,99440716", "11,97004898",
"14,15027361", "17,99440716", "11,97004898", "15,62072862", "17,63887641",
"17,99440716", "15,62072862", "14,15027361", "17,63887641", "11,97004898",
"15,21412616", "11,97004898", "15,62072862", "17,99440716", "17,63887641",
"20,26702294", "14,15027361", "14,15027361", "17,99440716", "14,15027361",
"17,63887641", "14,15027361", "17,99440716", "17,99440716", "17,99440716",
"17,99440716", "17,99440716", "17,99440716", "14,15027361", "17,99440716",
"17,99440716", "17,99440716", "11,97004898", "17,63887641", "17,99440716",
"17,63887641", "20,26702294", "15,62072862"), Region = c("eastland",
"west coast", "southcoast", "eastland", "west coast", "east lake",
"upland", "east coast", "east lake", "southcoast", "upland",
"west coast", "middle country", "west coast", "east lake", "eastland",
"upland", "down dykes", "southcoast", "southcoast", "eastland",
"southcoast", "upland", "southcoast", "eastland", "eastland",
"eastland", "eastland", "eastland", "eastland", "southcoast",
"eastland", "eastland", "eastland", "west coast", "upland", "eastland",
"upland", "down dykes", "east lake")), row.names = c(NA, -40L
), class = c("tbl_df", "tbl", "data.frame"))
