library(lubridate) library(ggplot2) library(StreamMetabolism) library(xts) library(reshape) library(scales) XYZ <- sunrise.set(53.50,7.62102484703064, "2024/01/01", timezone="MET", num.days=370) sunrise <- XYZ$sunrise sunset <- XYZ$sunset sunrise <- strftime(sunrise, format="%R", tz="MET") sunset <- strftime(sunset, format="%R", tz="MET") XYZ["sr"] <- as.POSIXct(sunrise, format = "%H:%M") XYZ["ss"] <- as.POSIXct(sunset, format = "%H:%M") XYZ["timestamp"] <- align.time(XYZ$sunrise, 60*10) XYZ <- XYZ[c("timestamp", "sr", "ss")] locsrss <- ggplot(XYZ, aes(x=XYZ$timestamp)) + geom_line(aes(y=XYZ$sr)) + geom_line(aes(y=XYZ$ss)) + labs(title = " Sonnenauf-/Sonnenuntergang - XYZ 2024", x = "Datum", y = "Zeit") pdf("XYZ_SA_SU.pdf", paper="a4r", width=11) locsrss dev.off() png(filename="XYZ_SA_SU.png", width = 1400, height = 800, units = "px") locsrss dev.off() XYZ["Sonnenaufgang"] <- strftime(XYZ$sr, format="%H:%M") XYZ["Sonnenuntergang"] <- strftime(XYZ$ss, format="%H:%M") write.table(XYZ, file="XYZ_SaSu.csv", dec=',', sep=';', row.names=FALSE)