X-Git-Url: https://git.auder.net/assets/icon_infos.svg?a=blobdiff_plain;f=pkg%2FR%2Fplot.R;h=d501d9eaefceee4a312a9e65ad02e92a92012176;hb=2e0ef04b1bb097b43df90afe8e7200c39421aff2;hp=8675c620d568ed37a6fbf936e461fcab96a5e489;hpb=9b9bb2d490e356ff0393aec66b137cff0a64803d;p=talweg.git diff --git a/pkg/R/plot.R b/pkg/R/plot.R index 8675c62..d501d9e 100644 --- a/pkg/R/plot.R +++ b/pkg/R/plot.R @@ -30,24 +30,24 @@ plotError <- function(err, cols=seq_along(err)) { if (!is.null(err$abs)) err = list(err) - par(mfrow=c(2,2), mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5, lty=1) + par(mfrow=c(2,2), mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5) L = length(err) yrange = range( sapply(1:L, function(i) ( err[[i]]$abs$day ) ), na.rm=TRUE ) matplot( sapply( seq_len(L), function(i) err[[i]]$abs$day ), type="l", - xlab="Time (hours)", ylab="Mean |y - y_hat|", ylim=yrange, col=cols, lwd=2 ) + xlab="Time (hours)", ylab="Mean |y - y_hat|", ylim=yrange, col=cols, lwd=2, lty=1 ) yrange = range( sapply(1:L, function(i) ( err[[i]]$abs$indices ) ), na.rm=TRUE ) matplot( sapply( seq_len(L), function(i) err[[i]]$abs$indices ), type="l", - xlab="Time (days)", ylab="Mean |y - y_hat|", ylim=yrange, col=cols, lwd=2 ) + xlab="Time (days)", ylab="Mean |y - y_hat|", ylim=yrange, col=cols, lwd=2, lty=1 ) yrange = range( sapply(1:L, function(i) ( err[[i]]$MAPE$day ) ), na.rm=TRUE ) matplot( sapply( seq_len(L), function(i) err[[i]]$MAPE$day ), type="l", - xlab="Time (hours)", ylab="Mean MAPE", ylim=yrange, col=cols, lwd=2 ) + xlab="Time (hours)", ylab="Mean MAPE", ylim=yrange, col=cols, lwd=2, lty=1 ) yrange = range( sapply(1:L, function(i) ( err[[i]]$MAPE$indices ) ), na.rm=TRUE ) matplot( sapply( seq_len(L), function(i) err[[i]]$MAPE$indices ), type="l", - xlab="Time (days)", ylab="Mean MAPE", ylim=yrange, col=cols, lwd=2 ) + xlab="Time (days)", ylab="Mean MAPE", ylim=yrange, col=cols, lwd=2, lty=1 ) } #' Plot measured / predicted @@ -64,7 +64,8 @@ plotPredReal <- function(data, pred, index) measure = data$getSerie( pred$getIndexInData(index) )[1:length(pred$getForecast(1))] # Remove the common part, where prediction == measure - dot_mark <- ifelse(prediction[1]==measure[1], which.max(prediction==measure), 0) + dot_mark <- ifelse(prediction[1]==measure[1], + which.max(seq_along(prediction)[prediction==measure]), 0) prediction = prediction[(dot_mark+1):length(prediction)] measure = measure[(dot_mark+1):length(measure)]