+
+#' Plot relative conditional variability / absolute variability
+#'
+#' Draw the relative conditional variability / absolute variability based on filaments
+#' obtained by \code{computeFilaments}
+#'
+#' @param data Object return by \code{getData}
+#' @param indices Indices as output by \code{computeFilaments}
+#'
+#' @export
+plotRelativeVariability = function(data, indices, ...)
+{
+ ref_series = t( sapply(indices, function(i) {
+ c( data$getSerie(i), data$getSerie(i+1) )
+ }) )
+ ref_var = apply(ref_series, 2, sd)
+
+ # Determine indices of no-NAs days followed by no-NAs tomorrows
+ fdays = c()
+ for (i in 1:(tail(indices,1)-1))
+ {
+ if ( !any(is.na(data$getSerie(i)) | is.na(data$getSerie(i+1))) )
+ fdays = c(fdays, i)
+ }
+ global_var = c( apply(data$getSerie(fdays),2,sd), apply(data$getSerie(fdays+1),2,sd) )
+
+ yrange = range(ref_var, global_var)
+ par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5)
+ plot(ref_var, type="l", col=1, lwd=3, ylim=yrange,
+ xlab="Temps (heures)", ylab="Écart-type")
+ par(new=TRUE)
+ plot(random_var, type="l", col=2, lwd=3, ylim=yrange, xlab="", ylab="")
+ abline(v=24, lty=2, col=colors()[56])
+}