X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=pkg%2FR%2Fplot.R;h=465b6066d34f18ffed1000246a0f1ba8f65d6423;hb=9e0f25f6d5c73008c0ad59ea7b7e097b342f26b3;hp=59a26a7e0765826771741ad04aea9ed6663d6c74;hpb=d2ab47a744d8fb29c03a76a7ca2368dae53f9a57;p=talweg.git diff --git a/pkg/R/plot.R b/pkg/R/plot.R index 59a26a7..465b606 100644 --- a/pkg/R/plot.R +++ b/pkg/R/plot.R @@ -83,7 +83,7 @@ plotError <- function(err, cols=seq_along(err)) plotPredReal <- function(data, pred, index) { prediction = pred$getForecast(index) - measure = data$getSerie( pred$getIndexInData(index) )[length(prediction)] + measure = data$getSerie( pred$getIndexInData(index) )[1:length(prediction)] yrange = range(measure, prediction) par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5, lwd=3) plot(measure, type="l", ylim=yrange, xlab="Time (hours)", ylab="PM10") @@ -172,8 +172,8 @@ computeFilaments <- function(data, pred, index, predict_from, limit=60, plot=TRU ref_serie = c( data$getCenteredSerie( pred$getIndexInData(index)-1 ), data$getCenteredSerie( pred$getIndexInData(index) ) ) centered_series = rbind( - data$getCenteredSeries( pred$getParams(index)$indices ), - data$getCenteredSeries( pred$getParams(index)$indices+1 ) ) + data$getCenteredSeries( pred$getParams(index)$indices-1 ), + data$getCenteredSeries( pred$getParams(index)$indices ) ) yrange = range( ref_serie, quantile(centered_series, probs=c(0.025,0.975), na.rm=TRUE) ) par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5, lwd=2) @@ -208,8 +208,9 @@ plotFilamentsBox = function(data, fil, predict_from) stop("Functional boxplot requires the rainbow package") series_matrix = rbind( - data$getSeries(fil$neighb_indices), data$getSeries(fil$neighb_indices+1) ) + data$getSeries(fil$neighb_indices-1), data$getSeries(fil$neighb_indices) ) series_fds = rainbow::fds(seq_len(nrow(series_matrix)), series_matrix) + par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5) rainbow::fboxplot(series_fds, "functional", "hdr", xlab="Time (hours)", ylab="PM10", plotlegend=FALSE, lwd=2) @@ -234,12 +235,12 @@ plotFilamentsBox = function(data, fil, predict_from) #' @export plotRelVar = function(data, fil, predict_from) { - ref_var = c( apply(data$getSeries(fil$neighb_indices),1,sd), - apply(data$getSeries(fil$neighb_indices+1),1,sd) ) - fdays = .getNoNA2(data, 1, fil$index-1) + ref_var = c( apply(data$getSeries(fil$neighb_indices-1),1,sd), + apply(data$getSeries(fil$neighb_indices),1,sd) ) + tdays = .getNoNA2(data, 2, fil$index) global_var = c( - apply(data$getSeries(fdays),1,sd), - apply(data$getSeries(fdays+1),1,sd) ) + apply(data$getSeries(tdays-1),1,sd), + apply(data$getSeries(tdays),1,sd) ) yrange = range(ref_var, global_var) par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5)