I have a dataset and want to create a stack histogram. I have the code below for both data and the histogram itself. However, when I run this code, I do get values of 200, which is not what I want. I understand my code is adding the values of the different groups. but what i do want is for them to reflect the actual values instead.
bar graph for total LE
library
#library(ggplot2)
#library(viridis)
#library(hrbrthemes)
#dataset
group <- c(rep("Men 45" , 4) , rep("Men 65" , 4) , rep("Women 45" , 4) , rep("Women 65" , 4) )
pa <- rep(c("No activity" , "Inactive" , "Active", 'Very active') , 4)
value <- c(48.84,50.70, 51.06 , 51.15,51.11,52.38,52.80,52.90,29.17,30.44,30.86,30.99,30.24,31.69,32.17,32.29)
data <- data.frame(group,pa,value)
ggplot(data = data, aes(x=group, y=value, group = pa)) +
geom_col(aes(fill = pa), position = position_stack(reverse = TRUE)) +
geom_hline(yintercept = 0)