I am trying to add points to filled.countour
function in R. But I am not getting any success.
I followed this old post. My plot just shows a dot in green. I am looking for a sequence of points which changes color as specified by a color band (PointColors
in this case) . Cannot figure out why...
Here is my code:
dat1 <-structure(c(5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 8.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 6.9, 5.5, 8.5, 5.5, 6.9, 6.9, 5.5, 5.5, 5.6, 6.9, 5.5, 5.5, 5.5, 8.1, 5.5, 5.5, 5.5, 5.5, 5.5, 7.5, 5.5, 5.5, 5.5, 7.5, 5.7, 4.6, 5.7, 5.5, 5.5, 5.7, 6.5, 3.2, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 8.2, 5.5, 8.2, 5.5, 5.5, 5.6, 5.5, 5.5, 5.1, 5.5, 5.5, 5.5, 5.5, 6.3, 5.5, 3.6, 5.5, 5.5, 5.5, 5.5, 5.5, 6.2, 5.4, 6.6, 5.5, 5.8, 6.2, 5.5, 5.5, 5.5, 5.6, 5.4, 5.5, 5.8, 5.5, 5.5, 5.5, 6.1, 5.5, 6.5, 2.3, 5.5, 6.1, 5.5, 5.5, 7, 5.5, 5.8, 5.5, 5.5, 7.6, 4.1, 5.5, 6.8, 4.6, 1.5, 5.5, 5.5, 5.7, 5.7, 5.5, 3.4, 5.7, 5.5, 5.5, 5.5, 5.5, 5.7, 7.4, 5.7, 5.5, 5.7, 5.5, 5.5, 5, 1, 5.5, 4.2, 2.2, 5.5, 4.7, 3.2, 5.5, 4.5, 4.5, 4, 2.4, 5.5, 2.5, 4.1, 5.7, 5.5, 1.9, 3.6, 4.6, 3, 4.6, 5.5, 4, 3.7, 5.5, 4.6, 5.5, 5.5, 4.6, 4.7, 3.6, 5.5, 5.5, 4.6, 3.7, 4.6, 4.6, 6, 4, 5.5, 4.9, 1.6, 5.5, 6.6, 5.2, 6.4, 6.4, 4.9, 6.2, 6.2, 6.5, 6.4, 5.3, 5.5, 3.6, 5.7, 7.4, 5.9, 2.4, 5.3, 8.5, 5.3, 5.5, 7.4, 6, 5.5, 5.5, 3.3, 4.6, 8.5, 6.1, 5.5, 5.5, 5.5, 5.5, 6.9, 5.5, 6.5, 7, 6.4, 5.3, 8.2, 7.3, 2.4, 7.1, 6.3, 7.7, 3.9, 8.2, 6.3, 6.7, 8, 7.2, 5.6, 4.7, 7.7, 6.6, 5.2, 5.5, 5.2, 5.3, 5.2, 5.4, 5.5, 2.8, 7, 5.7, 6.8, 4.6, 6.2, 5.5, 5.8, 7.3, 5.1, 4.8, 3.5, 5.5, 5.8, 6.4, 6.7, 5.5, 5.5, 5.5, 5.5, 4.8, 6.7, 4.7, 7.2, 5.5, 3.5, 5.5, 4.9, 5.5, 5.5, 6.7, 3.7, 5.5, 5.5), .Dim = c(20L, 16L), .Dimnames = list(NULL, c("estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated", "estimated")))
Contourcolors <- colorRampPalette(c('yellow',"red"))(20)
PointColors <- c(rep('green',5),rep('blue',5))
filled.contour(dat1,col=Contourcolors,plot.axes={points((1:20),rep(.5,20),col=PointColors,cex=5,pch=19)})
Here is the plot.