...this is my first post in this community and I'm completely new to RStudio.
For my bachelor thesis I intend to use a stacked bar chart using ggplot2.
Researching the internet, I found an image with an interesting chart variant with separated segments which I find much easier to read.
Personally, I don't know a package that does something like this out of the box, but in principle, there is nothing out of extraordinary that I can see with the chart on the right.
Take a look here - https://ggplot2.tidyverse.org/reference/facet_grid.html.
I think facetting is the right approach. It's basically a single row with faceted bar-chart columns that aren't labelled. The y-axis is categorical, and the x-axis appears to be value based on the unshown variable that represents the segments in the first chart.
If out-of-the-box facetting doesn't work, you might want to take a look at the cowplot package, perhaps plot_grid().
library(tidyverse)
set.seed(12345)
# Dummy dataset. nb, I've created the numbers to be represented in the bars,
# the y values, and therefore use stat = 'identity' in geom_bar. Depending on
# your data you may not want to do that.
DF <- tibble(xstr = rep(LETTERS[1:5],each=4),
yval = runif(20),
what = rep(letters[1:4],times=5))
ggplot(DF) +
geom_bar(aes(x = xstr,
y = yval,
fill = what), stat = 'identity') +
facet_wrap(~ what, nrow = 1) +
coord_flip() +
theme_bw() + theme(strip.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank(),
axis.text.x = element_blank(),
panel.grid = element_blank(),
panel.border = element_blank())