I made a ggplot with 12 facets and would like to change the position of the strip.text to the bottom of the x-axis of each facet AND at the same time still display the x.axis.text. How can I do that? With the following code I changed the position of the strip.text via strip.bottom to the bottom but then I can't find a way to display the axis.text.x as well?! Any help is much appreciated!
Code:
plot <- ggplot(
data = data, aes(
x = SCHULJAHR,
y = Anteil_empfehlung,
group = RAUM_NAME
)) +
geom_bar(
aes(
fill = RAUM_NAME,
color = RAUM_NAME
),
position = "stack", stat = "identity"
) +
scale_color_manual(values = farben_stb) +
scale_fill_manual(values = farben_stb) +
geom_text(
data = schulformempfehlung_stb_gym %>%
filter(SCHULJAHR %in% c("2017", "2022")),
aes(
x = SCHULJAHR, y = round(Anteil_empfehlung),
label = sprintf("%.1f", Anteil_empfehlung)
),
size = 2.75,
angle = 90,
color = "white",
fontface = "bold",
vjust = 0.4,
hjust = 1.5
) +
facet_wrap(RAUM_NAME ~ ., ncol = 4, strip.position = "bottom") +
scale_y_continuous(labels = function(x) format(x, big.mark = ".", decimal.mark = ",")) +
scale_x_discrete(breaks = c("04", "21"), labels = c("04", "21")) +
guides(fill = "none", color = "none") +
labs(
title = "titletext...",
subtitle = "subtitle...",
x = "",
y = ""
) +
theme_minimal() +
theme(
axis.text.y = element_blank(),
axis.ticks.x = element_blank(),
strip.text = element_text(face = "bold", size = 10.5)
)
