plot_curvefits: plot_curvefits

View source: R/plot_curvefits.R

plot_curvefitsR Documentation

plot_curvefits

Description

plot_curvefits

Usage

plot_curvefits(
  d_fit,
  seasons,
  d_obs = NULL,
  title = NULL,
  xlab = "Time",
  ylab = "Vegetation Index",
  yticks = NULL,
  font.size = 14,
  theme = NULL,
  cex = 2,
  shape = "point",
  angle = 30,
  show.legend = TRUE,
  layer_extra = NULL,
  ...
)

Arguments

d_fit

data.frame of curve fittings returned by get_fitting().

seasons

growing season division object returned by season() and season_mov().

d_obs

data.frame of original vegetation time series, with the columns of t, y and QC_flag. If not specified, it will be determined from d_fit.

title

String, title of figure.

xlab, ylab

String, title of xlab and ylab.

yticks

ticks of y axis

font.size

Font size of axis.text

theme

ggplot theme

cex

point size for VI observation.

shape

the shape of input VI observation? line or point

angle

text.x angle

show.legend

Boolean

layer_extra

(not used) extra ggplot layers

...

ignored

Examples

data("CA_NS6")
d = CA_NS6

nptperyear <- 23
INPUT <- check_input(d$t, d$y, d$w, QC_flag = d$QC_flag,
     nptperyear = nptperyear, south = FALSE,
     maxgap = nptperyear/4, alpha = 0.02, wmin = 0.2)
# plot_input(INPUT)

# Rough fitting and growing season dividing
wFUN <- "wTSM"
brks2 <- season_mov(INPUT,
    options = list(
        rFUN = "smooth_wWHIT", wFUN = wFUN,
        r_min = 0.05, ypeak_min = 0.05,
        lambda = 10,
        verbose = FALSE
    ))
# plot_season(INPUT, brks2, d)
# Fine fitting
fits <- curvefits(
    INPUT, brks2,
    options = list(
        methods = c("AG", "Beck", "Elmore", "Zhang"), #,"klos", "Gu"
        wFUN = wFUN,
        nextend = 2, maxExtendMonth = 2, minExtendMonth = 1, minPercValid = 0.2
    )
)

r_param = get_param(fits)
r_pheno = get_pheno(fits)
r_gof = get_GOF(fits)
d_fit = get_fitting(fits)

g <- plot_curvefits(d_fit, brks2)
grid::grid.newpage(); grid::grid.draw(g)

phenofit documentation built on May 29, 2024, 2:39 a.m.