Hi All,
I have a tricky problem here.
The short code below plots some percentiles from a simulation. The percentiles
are indicated in different colors.
Problem:
- How can I fill the area under the curve using the same colors as for the
percentiles-1?
- Also, I would like the rainbow intensity to look like a typical coloramp (used
for plotting climate variables) generated using for example:
colorRampPalette(c("darkred","red3","orange","yellow","darkblue"))
such that "0%" percentile values go from say "darkred" at
min(0%) and fade out before approaching "2.5%" whose color is
"red3". The same applies for other percentiles except "100%"
whose color intensity will increase with increased values.
#===================================================================================================================time<-1971:2000
matplot(time,t(ACF1SIM), type="l",ylim=c(0.2,2.5),
col=c("darkred","red3","orange","yellow","darkblue"),
lty=c(2,3,1,4,6),
lwd=c(2,1.9,2.5,1.9,2),cex.lab=1.4,cex.axis=1.5,ylab="Quantiles")#===================================================================================================================
#REPRODUCIBLE EXAMPLE
structure(c(0.406666666666667, 0.519, 0.935, 1.331, 1.49666666666667,
0.456666666666667, 0.54, 0.848333333333333, 1.20016666666667,
1.27, 0.526666666666667, 0.556333333333333, 0.883333333333333,
1.34783333333333, 1.44, 0.8, 0.923083333333333, 1.38666666666667,
1.85958333333333, 2.17666666666667, 0.883333333333333, 1.162,
1.655, 2.34658333333333, 2.65666666666667, 0.46, 0.579666666666667,
0.908333333333333, 1.53366666666667, 1.58, 0.74, 0.87475, 1.37333333333333,
1.76875, 1.95, 0.686666666666667, 0.74475, 1.09833333333333,
1.48508333333333, 1.56666666666667, 0.633333333333333, 0.746666666666667,
1.04, 1.448, 1.61666666666667, 0.516666666666667, 0.576166666666667,
0.978333333333333, 1.40191666666667, 1.46666666666667, 0.46,
0.559833333333333, 0.913333333333333, 1.28858333333333, 1.53333333333333,
0.71, 0.8095, 1.26, 1.87658333333333, 2.15, 0.656666666666667,
0.70825, 0.933333333333333, 1.31716666666667, 1.41, 0.67, 0.79075,
1.11333333333333, 1.59508333333333, 1.69, 0.78, 0.81125, 1.18333333333333,
1.58875, 1.73666666666667, 0.813333333333333, 0.9095, 1.32666666666667,
1.87066666666667, 1.93666666666667, 0.763333333333333, 0.80475,
1.15, 1.57908333333333, 1.83666666666667, 0.596666666666667,
0.682833333333333, 1.07833333333333, 1.5515, 1.81666666666667,
0.476666666666667, 0.673166666666667, 1.04, 1.53, 2.11666666666667,
0.706666666666667, 0.79825, 1.11, 1.66875, 1.79333333333333,
0.656666666666667, 0.773166666666667, 1.17166666666667, 1.6275,
1.75, 0.493333333333333, 0.534583333333333, 0.846666666666667,
1.19416666666667, 1.30666666666667, 0.633333333333333, 0.719916666666667,
1.12666666666667, 1.52525, 1.93, 0.383333333333333, 0.45025,
0.843333333333333, 1.18741666666667, 1.26, 0.37, 0.401416666666667,
0.655, 0.998416666666667, 1.11666666666667, 0.366666666666667,
0.584916666666667, 0.895, 1.3, 1.42333333333333, 0.43, 0.483,
0.813333333333333, 1.264, 1.38, 0.45, 0.533, 0.893333333333333,
1.31858333333333, 1.46, 0.706666666666667, 0.747916666666667,
1.09333333333333, 1.58575, 1.69666666666667, 0.41, 0.479166666666667,
0.755, 1.2035, 1.37), .Dim = c(5L, 30L), .Dimnames = list(c("0%",
"2.5%", "50%", "97.5%", "100%"), NULL))
Many thanks for your insightful feedbacks.
Asong.