I want the the x axis (before using coord_flip()
the y axis) in the following plot to start at one value (say at 20) for the left chart and at another value (say at 80) for the right chart. I tried using ylim()
inside coord_flip()
but that does not work for me since (1) in reality the left axis has negative values and (2) it would make the axis in both plots start at the same value.
I found this post where they use geom_segment()
in combination with scale_y_continuous
but I also don't know how to make this work for two plots with a shared axis.
ggplot2 flipped y-axis bars not showing with correctly set limits
This is my code:
librarian::shelf(ggpol, tidyverse)
dat <-
tibble(group = rep(letters[1:5], each = 2),
type = factor(paste0("type", rep(c(1:2), 5))),
value = c(-50, 110, -45, 120, -40, 130, -35, 140, -30, 150))
dat %>%
ggplot(aes(x = group, y = value)) +
geom_col() +
coord_flip() +
facet_share(~type, scales = "free", reverse_num = TRUE)