I have the following data:
I would like to generate a bar plot that shows the frequency of each value of Var1
per each run. I want the x axis represents each run and the y axis represents the frequency of each Var1
value. To do that, I wrote the following R script:
df <- read.csv("/home/nasser/Desktop/data.csv")
g <- ggplot(df) +
geom_bar(aes(Run, Freq, fill = Var1, colour = Var1), position = "stack", stat = "identity")
The result that I got is:
The issue is that the x axis does not show each run seperately (the axis should be 1, 2, .., etc) and the legend should show each value of Var1
seperately and in a different color. Also, the bars are not so clear since it is so difficult to see the frequency of each Var1
values. In other words, the generated plot is not the normal stacked bar like the one shown in this answer
How to solve that?