Learn R Programming

dtwSat (version 0.2.8)

plotChanges: Plotting changes

Description

Method for plotting changes over time.

Usage

plotChanges(
  x,
  time.levels = NULL,
  time.labels = NULL,
  class.levels = NULL,
  class.labels = NULL,
  class.colors = NULL
)

Value

A ggplot object.

Arguments

x

An object of class twdtwRaster.

time.levels

A character or numeric vector with the layers to plot. For plot type ''change'' the minimum length is two.

time.labels

A character or numeric vector with the labels of the layers. It must have the same length as time.levels. Default is NULL.

class.levels

A character or numeric vector with the levels of the raster values. Default is NULL.

class.labels

A character or numeric vector with the labels of the raster values. It must have the same length as class.levels. Default is NULL.

class.colors

A set of aesthetic values. It must have the same length as class.levels. Default is NULL. See scale_fill_manual for details.

Author

Victor Maus, vwmaus1@gmail.com

References

Maus:2019dtwSat

Maus:2016dtwSat

See Also

twdtwRaster-class, twdtwApply, plotArea, plotMaps, and plotDistance.

Examples

Run this code
if (FALSE) {
# Run TWDTW analysis for raster time series 
patt = MOD13Q1.MT.yearly.patterns
evi = brick(system.file("lucc_MT/data/evi.tif", package="dtwSat"))
ndvi = brick(system.file("lucc_MT/data/ndvi.tif", package="dtwSat"))
red = brick(system.file("lucc_MT/data/red.tif", package="dtwSat"))
blue = brick(system.file("lucc_MT/data/blue.tif", package="dtwSat"))
nir = brick(system.file("lucc_MT/data/nir.tif", package="dtwSat"))
mir = brick(system.file("lucc_MT/data/mir.tif", package="dtwSat"))
doy = brick(system.file("lucc_MT/data/doy.tif", package="dtwSat"))
timeline = scan(system.file("lucc_MT/data/timeline", package="dtwSat"), what="date")
rts = twdtwRaster(evi, ndvi, red, blue, nir, mir, timeline = timeline, doy = doy)

time_interval = seq(from=as.Date("2007-09-01"), to=as.Date("2013-09-01"), 
                    by="12 month")
log_fun = weight.fun=logisticWeight(-0.1,50)

r_twdtw = twdtwApply(x=rts, y=patt, weight.fun=log_fun, breaks=time_interval, 
          filepath="~/test_twdtw", overwrite=TRUE, format="GTiff")

r_lucc = twdtwClassify(r_twdtw, format="GTiff", overwrite=TRUE)

plotChanges(r_lucc)

}

Run the code above in your browser using DataLab