I have a dataset looking at the percentage of excitatory versus inhibitory cells across different parts of the brain. I want to create a plot where each part of the brain is on the x axis and the y axis is 100%. I want each bar of the brain area to be coloured the percentage that it is inhibitory and excitatory. Google drive version of graph I want
So far using the below code the plot is not what I want because it is just colouring the % of inhibitory as a gradient graph I don't want:
dataframe <- data.frame(area = c("area1", 'area2', "area3"), total_cells = c('30303', '57464', '28484'), percent_excitatory = c(10, 45, 60), percent_inhibitory = c(90, 55, 40))
ggplot(dataframe, aes(x=area, y=total_cells, fill=percent_inhibitory)) +
geom_bar(position = 'fill', stat = 'identity') +
scale_y_continuous(labels = scales::percent_format()) +
coord_flip()