plot_curvefits

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
)

Arguments

d_fit

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

seasons

Growing season dividing 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 to be applied

cex

point size for VI observation.

shape

the shape of input VI observation? line or point

angle

text.x angle

show.legend

Boolean

Examples

library(phenofit)
#> Error in library(phenofit): there is no package called ‘phenofit’
data("MOD13A1")
#> Warning: data set ‘MOD13A1’ not found
df <- tidy_MOD13(MOD13A1$dt)
#> Error in tidy_MOD13(MOD13A1$dt): object 'MOD13A1' not found
st <- MOD13A1$st
#> Error in eval(expr, envir, enclos): object 'MOD13A1' not found
date_start <- as.Date('2013-01-01') date_end <- as.Date('2016-12-31') sitename <- 'CA-NS6' # df$site[1] d <- df[site == sitename & (date >= date_start & date <= date_end), ]
#> Error in eval(expr, envir, enclos): object 'site' not found
sp <- st[site == sitename, ]
#> Error in eval(expr, envir, enclos): object 'st' not found
south <- sp$lat < 0
#> Error in eval(expr, envir, enclos): object 'sp' not found
nptperyear <- 23 # global parameter IsPlot = TRUE print = FALSE ypeak_min = 0.05 wFUN = wTSM # add one year in head and tail # d <- add_HeadTail(d, south = south, nptperyear = nptperyear) INPUT <- check_input(d$t, d$y, d$w, QC_flag = d$QC_flag, nptperyear = nptperyear, south = south, maxgap = nptperyear/4, alpha = 0.02, wmin = 0.2)
#> Error in check_input(d$t, d$y, d$w, QC_flag = d$QC_flag, nptperyear = nptperyear, south = south, maxgap = nptperyear/4, alpha = 0.02, wmin = 0.2): object 'd' not found
# Rough fitting and growing season dividing brks2 <- season_mov(INPUT, rFUN = smooth_wWHIT, wFUN = wFUN, plotdat = d, IsPlot = IsPlot, IsPlot.OnlyBad = FALSE)
#> Error in season_mov(INPUT, rFUN = smooth_wWHIT, wFUN = wFUN, plotdat = d, IsPlot = IsPlot, IsPlot.OnlyBad = FALSE): object 'INPUT' not found
# Fine fitting fit <- curvefits( INPUT, brks2, methods = c("AG", "Beck", "Elmore", "Zhang"), #,"klos", "Gu" wFUN = wFUN, nextend = 2, maxExtendMonth = 2, minExtendMonth = 1, minPercValid = 0.2)
#> Error in curvefits(INPUT, brks2, methods = c("AG", "Beck", "Elmore", "Zhang"), wFUN = wFUN, nextend = 2, maxExtendMonth = 2, minExtendMonth = 1, minPercValid = 0.2): object 'INPUT' not found
## visualization df_fit <- get_fitting(fit)
#> Error in lapply(fit, get_fitting.fFITs): object 'fit' not found
g <- plot_curvefits(df_fit, brks2)
#> Error in unique(.): object 'df_fit' not found
grid::grid.newpage(); grid::grid.draw(g)
#> Error in grid::grid.draw(g): object 'g' not found