R: add line to contour plot

I would like to build the function f (x, y) using fill.contour () in R and add a line / curve to define points where the value of the function is 0. To give an example, let's say that the values ​​for my function are the values ​​in the set data of the volcano and instead of searching f (x, y) = 0, we want to add a line / curve to determine where the volcano value is 500. How can I do this? The following code correctly adds a point at point X = 500 and Y = 500. But how can I add a line so that only the points where volcano = 500 are connected by a line? I would like to use only basic graphics.

x <- 10*1:nrow(volcano)
y <- 10*1:ncol(volcano)
filled.contour(x, y, volcano, color = terrain.colors, plot.axes = { axis(1); axis(2); points(500, 500)})
+2
source share
1 answer

, :

#create a new plot
contour(x,y,volcano)
#use .filled.colour instead of filled.contour
.filled.contour(x, y, volcano,levels=seq(90,200,1),col=terrain.colors(109))
# add a contour plot with specific levels on top of the filled contour
contour(x,y,volcano, level=130,add=T)

, vectoor : level = c (130,150) 130 150

, ads.contour , fill.contour, (. help (fill.contour)).

.

0

Source: https://habr.com/ru/post/1655881/


All Articles