this is my first post and I am new to coding, I apologise if my post is not clean or I havent looked for answers enough.
I am trying to plot a stacked bar graph with ggplot2 and am almost there. Here is what I have so far. I have a data set with 2 columns (Length and Count). I have attached it to this post. I read it and plot it like this:
example <- read.delim("example.txt", sep",")
ggplot(data=example, aes(x=Length, y=Count, fill=Count))+geom_bar(stat="identity")
The graph this gives me is Fig1A
What I am looking for, however, is that every value in the column "Count" is given its own color. It should look like Fig1B (Excel example):
I tried to plot it the way I would plot it in Excel (Fig1C) but was not able to replicate this kind of plot with ggplot2, I wasnt able to have my data.frame fit this kind of layout.
Thank you