I would like to make a bar plot with percent format. here is my data set:
https://drive.google.com/file/d/1xpRqQwzKFuirpKYKcoi1qVYSaiA-D5WX/view?usp=sharing
load('test.Robj')
Here is my part of data looks like:
res.1.2 branch
AAACCTGCACCAGGCT 0 1
AAACCTGGTCATATGC 7 4
AAACCTGGTTAGTGGG 15 NA
AAACCTGTCCACGCAG 1 NA
AAACCTGTCCACGTTC 17 2
AAACGGGCACCGAATT 0 1
I tried to use this code to plot:
ggplot(test,aes(x = branch, y =factor(1),fill = res.1.2)) +
geom_bar(position = "fill",stat = "identity")+
scale_y_discrete(labels =scales::percent)
I want to make my y axis as percent of counts of res.1.2 in total(stacked bar chart, or similar to a pie chart),
quite similar to this issue
but I got this:
Any suggestion?