I have a dataframe like this one:
and want to plot in R something like this:
But for some reason I am really struggling with the grouped geom_bar code... Can you help me please?

0 Answer
We may use plot
from base R
barplot(t(df1), beside = TRUE, col = c("blue", "orange", "grey",
"yellow", "lightblue" ))
-output
Or if we need a ggplot/plotly
library(ggplot2)
library(dplyr)
library(tidyr)
library(plotly)
library(tibble)
p <- df1 %>%
rownames_to_column('rn') %>%
pivot_longer(cols = -rn) %>%
ggplot(aes(x = rn, y = value, fill = name)) +
geom_col(position = 'dodge') +
theme_bw()
ggplotly(p)
-output
df1 <- structure(list(A = c(65, 9, 7, 70, 9), B = c(23, 4, 5, 53, 2),
C = c(42, 5, 2, 17, 7), D = c(51, 7, 5, 57, 5), E = c(14,
2, 2, 13, 4)), class = "data.frame", row.names = c("AAA",
"BBB", "CCC", "DDD", "EEE"))
这家伙很懒,什么都没留下...