fix plot quantiles
[talweg.git] / pkg / R / plot.R
index e414798..7b5f2b5 100644 (file)
@@ -8,12 +8,12 @@
 #' @export
 plotCurves <- function(data, indices=seq_len(data$getSize()))
 {
-       yrange = quantile( range( sapply( indices, function(i) {
+       yrange = quantile( sapply( indices, function(i) {
                serie = c(data$getCenteredSerie(i))
                if (!all(is.na(serie)))
                        range(serie, na.rm=TRUE)
                c()
-       }) ), probs=c(0.05,0.95) )
+       }), probs=c(0.05,0.95) )
        par(mar=c(4.7,5,1,1), cex.axis=1.5, cex.lab=1.5)
        for (i in seq_along(indices))
        {
@@ -75,7 +75,7 @@ computeFilaments <- function(data, index, limit=60, plot=TRUE)
                sqrt( sum( (ref_serie - data$getCenteredSerie(i))^2 ) / L )
        })
        indices = sort(distances, index.return=TRUE)$ix[1:min(limit,length(distances))]
-       yrange = quantile( range( ref_serie, sapply( indices, function(i) {
+       yrange = quantile( c(ref_serie, sapply( indices, function(i) {
                ii = fdays_indices[i]
                serie = c(data$getCenteredSerie(ii), data$getCenteredSerie(ii+1))
                if (!all(is.na(serie)))