diff --git a/README.Rmd b/README.Rmd index bf5d8ef..8825425 100644 --- a/README.Rmd +++ b/README.Rmd @@ -34,6 +34,7 @@ print(alig) Plot alignments ```{r define-demo-plot-alignments, eval=TRUE, include = TRUE} library(dtwSat) +library(ggplot2) library(gridExtra) gp1 = plot(alig, type="alignment", attribute="evi", alignment=1, shift=0.5) + ggtitle("Alignment 1") + @@ -48,61 +49,66 @@ grid.arrange(gp1,gp2,nrow=2) Plot path for all classese ```{r define-demo-plot-paths, eval=TRUE, include = TRUE} library(dtwSat) +library(ggplot) library(gridExtra) gp.list = lapply(query.list, function(query){ - alig = twdtw(query, template, weight = "logistic", alpha = 0.1, beta = 50, - alignments = 4, keep = TRUE) + alig = twdtw(query, template, weight = "logistic", alpha = 0.1, + beta = 100, alignments = 4, keep = TRUE) plot(alig, normalize = TRUE, show.dist = TRUE) + - ggtitle(names(query.list)[2]) + theme(axis.title.x=element_blank(), legend.position="none") }) -grid.arrange(gp.list[[1]], - gp.list[[2]], - gp.list[[3]], +grid.arrange(gp.list[[1]] + ggtitle(names(query.list)[1]), + gp.list[[2]] + ggtitle(names(query.list)[2]), + gp.list[[3]] + ggtitle(names(query.list)[3]), nrow=3) ``` - -
- malig = mtwdtw(query.list, template, weight = "logistic",
- alpha = 0.1, beta = 100)
+Plot classification
+```{r define-demo-plot-classification, eval=TRUE, include = TRUE}
+library(dtwSat)
+library(ggplot2)
+library(gridExtra)
+malig = mtwdtw(query.list, template, weight = "logistic",
+ alpha = 0.1, beta = 100)
- gp = plot(x=malig, type="classify", attribute="evi", from=as.Date("2009-09-01"),
- to=as.Date("2013-09-01"), by = "6 month",
- normalized=TRUE, overlap=.7)
- gp
-
-
- df = data.frame(Time=index(template), value=template$evi, variable="Raw")
- df = rbind( df, data.frame(Time=index(sy), value=sy$evi, variable="Wavelet filter") )
- gp = ggplot(df, aes(x=Time, y=value, group=variable, colour=variable)) +
- geom_line() +
- theme(legend.position="bottom") +
+gp1 = plot(x=malig, type="classify", from=as.Date("2009-09-01"),
+ to=as.Date("2013-09-01"), by = "6 month",
+ normalized=TRUE, overlap=.7)
+
+gp2 = plot(x=malig, type="classify", attribute = c("evi","ndvi"),
+ from=as.Date("2009-09-01"), to=as.Date("2013-09-01"),
+ by = "6 month", normalized=TRUE, overlap=.7)
+
+grid.arrange(gp1,gp2,nrow=2)
+```
+
+
+
+Plot wavelet smoothing
+```{r define-demo-plot-smoothing, eval=TRUE, include = TRUE}
+library(dtwSat)
+library(ggplot2)
+library(reshape2)
+library(gridExtra)
+sy = waveletSmoothing(x=template, frequency=8, wf = "la8", J=1,
+ boundary = "periodic")
+df1 = data.frame(Time=index(template), value=template$evi, variable="Raw")
+df1 = rbind(df1, data.frame(Time=index(sy), value=sy$evi, variable="Wavelet filter") )
+gp1 = ggplot(df1, aes(x=Time, y=value, group=variable, colour=variable)) +
+ geom_line() +
+ # theme(legend.position="bottom") +
ylab("EVI")
- gp
-
- git clone https//github.com/vwmaus/dtwSat.git
.dtwSat.Rproj
.install.packages(c("roxygen2", "testthat"))
.
- malig = mtwdtw(query.list, template, weight = "logistic",
- alpha = 0.1, beta = 100)
+```r
+library(dtwSat)
+library(ggplot2)
+library(gridExtra)
+malig = mtwdtw(query.list, template, weight = "logistic",
+ alpha = 0.1, beta = 100)
- gp = plot(x=malig, type="classify", attribute="evi", from=as.Date("2009-09-01"),
- to=as.Date("2013-09-01"), by = "6 month",
- normalized=TRUE, overlap=.7)
- gp
-
-
- df = data.frame(Time=index(template), value=template$evi, variable="Raw")
- df = rbind( df, data.frame(Time=index(sy), value=sy$evi, variable="Wavelet filter") )
- gp = ggplot(df, aes(x=Time, y=value, group=variable, colour=variable)) +
- geom_line() +
- theme(legend.position="bottom") +
+gp1 = plot(x=malig, type="classify", from=as.Date("2009-09-01"),
+ to=as.Date("2013-09-01"), by = "6 month",
+ normalized=TRUE, overlap=.7)
+
+gp2 = plot(x=malig, type="classify", attribute = c("evi","ndvi"),
+ from=as.Date("2009-09-01"), to=as.Date("2013-09-01"),
+ by = "6 month", normalized=TRUE, overlap=.7)
+
+grid.arrange(gp1,gp2,nrow=2)
+```
+
+![plot of chunk define-demo-plot-classification](figure/define-demo-plot-classification-1.png)
+
+
+
+Plot wavelet smoothing
+
+```r
+library(dtwSat)
+library(ggplot2)
+library(reshape2)
+library(gridExtra)
+sy = waveletSmoothing(x=template, frequency=8, wf = "la8", J=1,
+ boundary = "periodic")
+df1 = data.frame(Time=index(template), value=template$evi, variable="Raw")
+df1 = rbind(df1, data.frame(Time=index(sy), value=sy$evi, variable="Wavelet filter") )
+gp1 = ggplot(df1, aes(x=Time, y=value, group=variable, colour=variable)) +
+ geom_line() +
+ # theme(legend.position="bottom") +
ylab("EVI")
- gp
-
- git clone https//github.com/vwmaus/dtwSat.git
.dtwSat.Rproj
.install.packages(c("roxygen2", "testthat"))
.