I have data similar to following:
X <- 1:20
B <- c(1,4,6,3,1, 4, 5,8,8,6,3,2,1, 1,5,7,8,6,4,2)
C <- B + 4
myd <- data.frame (X, B, C)
I want to shade with different color within the curve. Please note the boundries color filling in x
region 1 = 1 to 6
region 2 = 6 to 16
region 3 = 16 to 20
Based on Gong-Yi's answer, though I have to modify the data to fill the lower polygon. The complete answer is as follows:
Just demonstrate the 1:6 section:
Here is a solution with ggplot2.