Hey guys, I'm trying to do a stacked barplot / histogram which has the observation dates on the x axis and the total of sighted pods (of whales) on the y axis. The amount of pods inside the experimental area should be part of the total bars, so that you can directly see how many pods per day were inside the experiment. Ideally even with numbers on top. The code I got so far:
library(ggplot2)
PodsBoth <- read.table("PodsBoth.txt", header = TRUE)
colnames(PodsBoth) <- c("Date", "Total", "Inside")
ggplot(PodsBoth, aes(x = Date, y=Total, color = Inside, fill=Inside)) +
geom_histogram(position = "stack", stat = "identity", color="white")
What I get out of it:
Somehow the color coding is like that and I really don't know why ( R beginner, sorry )
Maybe you guys have an idea or solution.
Date Pods Inside
2021-06-23 3 0
2021-06-24 11 0
2021-06-25 5 1
2021-06-26 14 1
2021-06-28 6 2
2021-06-29 1 0
2021-07-03 2 0
2021-07-04 6 1
2021-07-08 5 0
2021-07-09 6 0
2021-07-11 16 2
2021-07-12 4 0
2021-07-13 13 3
2021-07-14 6 0
2021-07-15 19 3
2021-07-16 23 1
2021-07-19 10 2
2021-07-21 13 4
2021-07-22 8 2
2021-07-23 27 9
2021-07-26 14 6
2021-07-27 8 7
2021-08-04 45 20
2021-08-05 20 12
2021-08-06 2 1
2021-08-07 19 14
2021-08-10 4 2
2021-08-11 6 6
2021-08-12 20 13
2021-08-13 0 0
2021-08-21 34 16
2021-08-22 9 9
2021-08-23 16 15
Thats what my data frame looks like. Sorry I'm not that good in reprex etc. Hope you can work with what I gave you. Thanks in advance.