I have followed barplot example:
library(ggplot2)
df <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/violin_data.csv")
g <- ggplot(df, mapping = aes(forcats::fct_infreq(sex), fill = as.factor(size))) +
geom_bar(colour = "white") + coord_flip() +
geom_text(aes(label = paste0("n=", ..count..)), stat='count',
position = position_stack(vjust = 0.5))
g
Which gives me:
What I want is the mean of the size from the Female and the Male:


