library(reshape)
library(dplyr)
library(ggplot2)
library(plotrix)
tide.dec$Time<-paste(tide.dec$DAY, tide.dec$HOUR, sep=" ")
tide.dec<-na.omit(tide.dec)
tide.dec$Time<-as.POSIXct(tide.dec$Time,format="%d-%m-%Y %H:%M",tz="UTC")
tide.dec$days<-as.numeric(substring(tide.dec$DAY,1,2))
str(tide.dec)
#####3.1. Tide plot for december ####
ggplot(data=subset(tide.dec,tide.dec$days>22&tide.dec$days<31),aes(x=HOUR,y=HEIGHT))+
geom_line(col="blue",size=1)+
labs(x="Time",y="Tidal height(m)",title="Tidal changes in Dec-2022. Red blocks indicate observing time at VP")+
theme_bw()+
theme(axis.text.x = element_text(size=8),
axis.text.y = element_text(size=10))+
scale_x_datetime(date_breaks = "04 hours", date_labels = "%Y-%m-%d %H:%M:%S")+
theme(axis.text.x = element_text(angle = 90, hjust = 1))+
#Day1
annotate("rect",
xmin = as.POSIXct("2022-12-23 06:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-23 16:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)+
#Day2
annotate("rect",
xmin = as.POSIXct("2022-12-24 06:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-24 16:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)+
#Day3
annotate("rect",
xmin = as.POSIXct("2022-12-25 07:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-25 17:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)+
#Day4
annotate("rect",
xmin = as.POSIXct("2022-12-26 07:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-26 18:00:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)+
#Day5
annotate("rect",
xmin = as.POSIXct("2022-12-27 08:00:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-27 18:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)+
#Day6
annotate("rect",
xmin = as.POSIXct("2022-12-28 05:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-28 16:00:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)+
#Day7
annotate("rect",
xmin = as.POSIXct("2022-12-29 05:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-29 16:00:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)+
#Day8
annotate("rect",
xmin = as.POSIXct("2022-12-30 06:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
xmax = as.POSIXct("2022-12-30 16:30:00",format="%Y-%m-%d %H:%M:%S",tz="UTC"),
ymin = -Inf, ymax = Inf, fill = "red", alpha=.3)