library(reshape2) library(ggpubr) library (ggplot2) theme_set(theme_minimal() + theme(legend.position = "botom")) ###VCI,TCI,VHI VI<- read.csv("C:/eksperimen/annal of GIS/data inves/inves19.csv", header=T, dec=",", sep=";") head(VI) df <- VI df$id_vi <- as.factor(df$id_vi) head(df[, c("id_vi", "year", "month", "veg_indices")], 4) #1 b <- ggplot(df, aes(x = year, y = veg_indices)) b + geom_point(aes(color = id_vi, shape = id_vi))+ geom_smooth(aes(color = id_vi, fill = id_vi), method = "lm", fullrange = TRUE) + facet_wrap(~id_vi) + scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07","#FC4E07"))+ scale_fill_manual(values = c("#00AFBB", "#E7B800", "#FC4E07", "#FC4E07")) + theme_bw()+ stat_cor(method = "pearson", label.x = 5, label.y = 90) #2 b <- ggplot(df, aes(x = year, y = veg_indices)) b + geom_point(aes(color = id_vi, shape = id_vi)) + geom_rug(aes(color = id_vi)) + geom_smooth(aes(color = id_vi), method = "lm", se = TRUE, fullrange = TRUE)+ scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07","#FC4E07" ))+ ggpubr::stat_cor(aes(color = id_vi),method = "pearson", label.x = 5)+ theme_bw() ###SAVI, NDVI VIS<- read.csv("C:/eksperimen/annal of GIS/data inves/inves25.csv", header=T, dec=",", sep=";") head(VIS) df <- VIS df$id_vi <- as.factor(df$id_vi) head(df[, c("id_vi", "year", "month", "veg_indices")], 4) #1 b <- ggplot(df, aes(x = year, y = veg_indices)) b + geom_point(aes(color = id_vi, shape = id_vi))+ geom_smooth(aes(color = id_vi, fill = id_vi), method = "lm", fullrange = TRUE) + facet_wrap(~id_vi) + scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07","#FC4E07"))+ scale_fill_manual(values = c("#00AFBB", "#E7B800", "#FC4E07", "#FC4E07")) + theme_bw()+ stat_cor(method = "pearson", label.x = 5, label.y = 1.6) #2 b <- ggplot(df, aes(x = year, y = veg_indices)) b + geom_point(aes(color = id_vi, shape = id_vi)) + geom_rug(aes(color = id_vi)) + geom_smooth(aes(color = id_vi), method = "lm", se = TRUE, fullrange = TRUE)+ scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07","#FC4E07" ))+ ggpubr::stat_cor(aes(color = id_vi),method = "pearson", label.x = 5)+ theme_bw() b + geom_point(aes(color = season, shape = season))+ stat_ellipse(aes(color = season), type = "t")+ scale_color_manual(values = c("#00AFBB", "#E7B800", "#FC4E07", "#FC4E07")) # Add group mean points and stars ggscatter(df, x = "year", y = "veg_indices", color = "id_vi", palette = "npg", shape = "id_vi", ellipse = TRUE, mean.point = TRUE, star.plot = TRUE, ggtheme = theme_minimal()) # Change the ellipse type to 'convex' ggscatter(df, x = "year", y = "veg_indices", color = "id_vi", palette = "npg", shape = "id_vi", ellipse = TRUE, ellipse.type = "convex", ggtheme = theme_minimal())