I am plotting data from two different years (07 and 08) on top of each other. These two years have slightly different dates, but when i plot it in R i am unable to get all the dates, R rearrange them to descending order, or splits them in two different years one after the other with a space between.
I need them on top of each other, with some of the dates slightly skewed.
The dates should be:
data_07[,1]<-c("7/6","21/6","31/6","14/7","28/7","11/8","25/8","8/9")
data_08[,1]<-c("7/6","21/6","5/7","19/7","2/8","16/8","25/8","8/9")
My script
data7 <- data.frame(
Date = c("7/6","21/6","31/6","14/7","28/7","11/8","25/8","8/9"),
variable = sample(c("Age 39-40", "Age 62-63"), 8, replace = TRUE),
value = sample(1:8)
)
data8 <- data.frame(
Date = c("7/6","21/6","5/7","19/7","2/8","16/8","25/8","8/9"),
variable = sample(c("Age 39-40", "Age 62-63"), 8, replace = TRUE),
value = sample(1:8)
)
p1<-ggplot(data7,
aes(x=Date, y=value, group=variable)) +
geom_point(size=2, shape = 15) +
geom_line(linetype=1) +
geom_line(data=data8, aes(x=Date, y=value, group=variable),linetype=2) +
geom_point(data=data8, size=2, shape = 1)
p1 + facet_wrap( ~ variable, nrow = 5, ncol = 1, scales= "fixed") +
labs(x="Dates", y="Catches per 20 traps", title="") +
theme(panel.grid.minor.y = element_blank(),
panel.grid.major.y = element_blank())
Any help and suggestions are appreciated. Thank you!
Daniel