\name{arrangePlot}
\alias{arrangePlot}

\title{
arrangePlot
}
\description{
plot muliple cerardat output
}
\usage{
arrangePlot(x,
            which=1:2,
            main="model dateEv (red) and dateAc (black)",
            xlab="Date",
            ylab="Density",
            col1=rgb(0.93,0.23,0.23,0.5),
            col2="black",
            xlim=NULL,
            ylim=NULL,
            date=NULL,
            col_date=NULL,
            lty_date=NULL,...
)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{x}{
a \link[SPARTAAS]{cerardat} output.
}
  \item{which}{
  Vector containing the plots you want (rownames or row number on the contingence table: numeric).
}
  \item{main}{
  an overall title for the plot: see title \link[graphics]{title}.
}
  \item{xlab}{
  a title for the x axis: see \link[graphics]{title}.
}
  \item{ylab}{
  a title for the y axis: see \link[graphics]{title}.
}
  \item{col1}{
  Color of the Event curve (color name, hex code, \link[grDevices]{rgb} function \{grDevices\} for transparency).
}
  \item{col2}{
  Color of the Accumulation curve (color name, hex code, \link[grDevices]{rgb} function \{grDevices\} for transparency).
}
  \item{xlim}{
  Two numeric values, specifying the left limit and the right limit of the scale.
}
  \item{ylim}{
  Two numeric values, specifying the lower limit and the upper limit of the scale.
}
  \item{date}{
  x coordinate to highlight with a vertical line accross all plots (vector).
}
  \item{col_date}{
  Vector of color for vertical lines (one for each date, could be numeric, hexadecimal, rgb).
}
  \item{lty_date}{
  Vector of line type (see lty in \link[graphics]{par}, don't use lty with arrangePlot) for vertical lines.
}
  \item{...}{
  other parameters to be passed through to plotting functions (bty, lwd, cex.axis see \link[graphics]{par}).
}
  
}

\author{
A. COULON

L. BELLANGER

P. HUSI
}
\examples{
\donttest{
data("datacerardat")

resultat = cerardat(df = datacerardat$df,
  row.sup = datacerardat$row.sup,
  date = datacerardat$date,
  nf = NULL,
  confidence = 0.95,
  graph = TRUE
)

#Plot the first 5 with their dateEv fit as vertical line
arrangePlot(resultat,
  which = 1:5,
  date = resultat$prediction$Fit_dateEv[1:5]
)
arrangePlot(resultat,
  which = 1:5,
  xlim = c(300, 600),
  date = resultat$prediction$Fit_dateEv[1:5]
)

#Plot using row names and highlighting custom dates
arrangePlot(resultat,
  which = c("Z067","Z070","Z074"),
  main = "Neuvy-Le-Roi", 
  xlim = c(300, 1300), 
  date = c(669, 745, 850, 1115),
  col_date = c("red", rgb(0.20, 0.40, 0.30), 4, '#5614be')
)

#You can change the line type (lty) and the color of the curve
arrangePlot(resultat,
  which = c("Z067", "Z070", "Z074"),
  main = "Neuvy-Le-Roi", 
  col1 = rgb(0.7, 0.7, 0.7, 0.6), # the last arg of rgb is alpha for opacity
  col2 = "black",
  xlim = c(300, 1300), 
  date = c(669, 745, 850, 1115), 
  col_date = "grey50",
  lty_date = c(1, 2, 3, 4)    # 1: line, 2: dashed line, 3: dotted line, 4:mixed dotted dashed line)
)

#Default first 10 plot
arrangePlot(resultat, which = 1:10)

#You can remove the box arround the plot region
arrangePlot(resultat,
  which = 1:10,
  xlim = c(200, 1000),      # fix the x axis between 200 and 1000
  date = seq(250, 950, 50), # add one line every 50 years between 250 and 950
  col_date = "grey80",
  lty_date = 3,      # dotted line (1: line, 2: dashed line)
  bty = 'n',         # remove box ('L': keep bottom and left) 
  cex.axis = 0.8     # control axis text size (only y axis here) 
)

#minimalist version (remove y-axis)
arrangePlot(resultat,
  which = 1:10,
  xlim = c(200, 1000),       # fix the x axis between 200 and 1000
  date = seq(250, 950, 50),  # add one line every 50 years between 250 and 950
  col_date = "grey80",
  lty_date = 3,              # dotted line (1: line, 2: dashed line)
  ylab = '',                 # remove the y-axis name ('Density')
  fg = rgb(0, 0, 0, 0),      # color box transparent (invisible) 
  col.axis = rgb(0, 0, 0, 0) # color axis text (only y axis here) transparent (invisible)
)

}
}
