# ts_makeframes: Create spatial ggplots of a raster time series In JohMast/rtsVis: Raster Time Series Visualization

 ts_makeframes R Documentation

## Create spatial ggplots of a raster time series

### Description

Create spatial ggplots of a raster time series

### Usage

ts_makeframes(
x_list,
r_type = NULL,
minq = 0.02,
maxq = 0.98,
samplesize = 1000,
blacken_NA = FALSE,
l_indices = NULL,
alpha = NULL,
...
)


### Arguments

 x_list a list of raster objects. r_type (Optional) character, one of "discrete", "gradient" or "RGB". By default, attempts to discern the r_type from the content of r_list. minq (Optional) numeric, lower quantile boundary for the stretch. Default is 0.02. maxq (Optional) numeric, upper quantile boundary for the stretch. Default is 0.98. samplesize (Optional) numeric, number of samples per layer to determine the quantile from. See sampleRegular for details on the sampling. Default is 1000. blacken_NA (Optional) logical. If TRUE: set NA to 0. Default is FALSE. l_indices (Optional) numeric, a vector of layer indices specifying which layers are to be plotted. Should contain 3 values for an RGB image or a single value for a discrete or gradient image. By default, chooses the first three layers if r_type is "RGB" and the first layer if r_type is "discrete" or "gradient". alpha (Optional) numeric. The opacity of the plot. Default is 1. hillshade (Optional) A raster layer. If one is provided, it will be used as the base layer and plotted with ggR while the raster layers from x_list will be plotted over it with a default alpha of 0.5. By default, no hillshade is used. ... (Optional) further arguments for the plotting.

### Details

A linear percent stretch will be applied to each band to improve contrast. #

(X - Low_{in}) * \frac{((High_{out}-Low_{out})}{(High_{in}-Low_{in}))} + Low_{out}

# The stretch parameters # High_{out},Low_{out},High_{in},Low_{in} # are calculated separately for each band based on the minq and maxq which are first applied to samplesize regular samples (see sampleRegular) of each individual layer. From these, across all layers belonging to a certain band, the minimum and maximum values are taken as the stretching parameters for the linear stretch, which is performed using rescaleImage. Discrete r_types will not be stretched. To further enhance the plots, consider using functionalities implemented in moveVis, (see http://movevis.org/ ). For example, a northarrow may be added to all frames using add_northarrow.

### Value

A list of ggplots

Johannes Mast

### Examples

#Setup
# Load example dataset at a greatly increased interval
x_list <- MODIS_SI_ds[seq(1,length(MODIS_SI_ds),25)]
x_dates <- do.call(c, lapply(MODIS_SI_ds,attr,"time") )[seq(1,length(MODIS_SI_ds),25)]

#Fill NAs
x_list_filled <- ts_fill_na(x_list)

#Make a sequence of output dates, double the length of input dates
out_dates <-seq.POSIXt(from = x_dates[1],
to = x_dates[length(x_dates)],length.out = length(x_dates)*2 )

#For each output date, interpolate a raster image from the input files
r_list_out <- ts_raster(r_list = x_list_filled,
r_times = x_dates,
out_times = out_dates,