How to imagine the optimal area on the contour plot (filled with the contour) in a certain color?

I use the function filled.contourto build a contour map. I want to imagine the area around the optimum value in dark color and all other areas in light color.

library(gplots) 
a <- expand.grid(1:20, 1:20)
b <- matrix(a[, 1] + a[, 2], 20)
filled.contour(x = 1:20, y = 1:20, z = b,
               plot.axes = { axis(1); axis(2); points(10, 10) },
               col = colorpanel(10, "white", "grey10"))

I want to represent (10,10) the coordinates in dark gray and all other areas in light color. I also tried RColorBrewerand colorRampPalettechange the gradients, but did not give the desired result. How to change color gradients to achieve my goal?

Regards, Ashwani

+4
source share
1 answer

- , layout. x , :

rect(7,9.5,8,10.5,col='red')

?filled.contour, , . , , , , .

a <- expand.grid(1:20, 1:20)
b <- matrix(a[,1] + a[,2], 20)
filled.contour(x = 1:20, y = 1:20, z = b,
               plot.axes = { axis(1); axis(2); points(10, 10) })
+1

All Articles