Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have to try <code>polygon</code>. This code can be useful:</p> <pre><code>y98 = aggregate(gcdata$Pause.s. ~ hours, data=gcdata, FUN=q98) y02 = aggregate(gcdata$Pause.s. ~ hours, data=gcdata, FUN=q02) ymax = aggregate(gcdata$Pause.s. ~ hours, data=gcdata, FUN=max) ymin = aggregate(gcdata$Pause.s. ~ hours, data=gcdata, FUN=min) ymean = aggregate(gcdata$Pause.s. ~ hours, data=gcdata, FUN=mean) x = ymean[,1] y1 = cbind(y02[,2], ymean[,2], y98[,2]) y2 = cbind(ymin[,2], ymean[,2], ymax[,2]) plotAreaCI(x,y2, ylim=c(0,2), xlab="time", ylab="variable") plotAreaCI(x,y1, ylim=c(0,2), poly.col="blue", add=TRUE) </code></pre> <p><img src="https://i.stack.imgur.com/APj8p.png" alt="pic1"></p> <p>or</p> <pre><code>plotAreaCI(x,y2, ylim=c(0,2), xlab="time", ylab="variable", nice.x = TRUE) plotAreaCI(x,y1, ylim=c(0,2), mean.lwd=2, poly.col="blue", add=TRUE) </code></pre> <p><img src="https://i.stack.imgur.com/cMonB.png" alt="pic2"></p> <p>where the function <code>plotAreaCI</code> is defined by:</p> <pre><code>plotAreaCI = function(x, y, add=FALSE, nice.x = FALSE, xlim=NULL, ylim=NULL, mean.col="black", mean.lwd=1.5, poly.col="gray", poly.lty=3, xlab=NULL, ylab=NULL, main="", ...) { isFactorX = isClass("factor", x) if(isFactorX) { x.label = x x = as.numeric(x) } if(is.null(xlim)) xlim=range(x, na.rm=TRUE) if(is.null(ylim)) ylim=range(y, na.rm=TRUE) x.pol = c(x, rev(x), x[1]) y.pol = c(y[,1], rev(y[,3]), y[,1][3]) if(!add) { plot.new() plot.window(xlim=xlim, ylim=ylim, ...) if(!nice.x &amp; isFactorX) { axis(1, at=x, labels=x.label) } else { xticks = axTicks(1) if(isFactorX) { xticks = xticks[xticks&gt;=1] axis(1, at=xticks, labels=x.label[xticks]) } else { axis(1) } } axis(2, las=1) box() title(xlab=xlab, ylab=ylab, main=main) } polygon(x.pol, y.pol, col=poly.col, lty=poly.lty) lines(x, y[,2], col=mean.col, lwd=mean.lwd) return(invisible()) } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload