Show percent of 3 variable in a stacked bar chart????


I am new to R. I have been trying for days to produce a 100% stacked bar chart that has one bar that show the percent of three different proteins.

I have been able to produce a percentage bar chart, but not stacked. This is what it looks like so far:

The data is just one column in excel. I put another column next to it full of "1". That seemed to help. So, basically I don't have a y column. It is more of a frequency percent chart of three proteins. I would like them to overlap on one bar. Can you help me?

This is the code I have used:
M <- read.csv('M.csv', header = TRUE)
ggplot(data = M) +
geom_bar(mapping = aes(x = Protein, y = ..prop.., group = 1), stat = "count")+
scale_y_continuous(labels = scales::percent_format())+
xlab("") +
ylab("Percent") +
ggtitle("Colocalization between Mi-2 and Akirin compared to isolated Mi-2 and AK")

Thank you,

Sarah Anglin


To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.