i have a bar chart with fill of two levels the y axis is categorical with 0,1. the bar chart shows the 0 count and 1 count now i want to show the each individual percentage of each bar on each bar so that i can see which bar is highest and then which 1 in each bar is higher. but my count is categorical
i want to show percentage of each individual bar as 100% then divided into groups.
ggplot(stackoverflow,aes(x=stackoverflow$person, fill=stackoverflow$success))+facet_wrap(~stackoverflow$city)+geom_bar()
structure(list(data = structure(list(source = structure(c(1L,
1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("p",
"q", "r"), class = "factor"), person = structure(c(1L, 1L, 1L,
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 1L), .Label = c("a", "b",
"c"), class = "factor"), city = structure(c(1L, 1L, 3L, 3L, 3L,
2L, 1L, 1L, 1L, 3L, 3L, 3L, 3L), .Label = c("x", "y", "z"), class = "factor"),
success = structure(c(1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 2L, 2L, 2L), .Label = c("0", "1"), class = "factor")), row.names = c(NA,
-13L), class = "data.frame"), layers = list(<environment>), scales = <environment>,
mapping = structure(list(x = ~stackoverflow$person, fill = ~stackoverflow$success), class = "uneval"),
theme = list(), coordinates = <environment>, facet = <environment>,
plot_env = <environment>, labels = list(x = "stackoverflow$person",
fill = "stackoverflow$success", y = "count", weight = "weight")), class = c("gg",
"ggplot"))
dput
function on your dataset. Likedput(df)
and then copy and paste the result into the question above. – akash87