2017-11-21 1 views
1

내가 값 5 수준의 주위에 레벨 선을 그릴과 레이블과 같은 것을 얻을 수있는 방법채워진 등고선에 레벨 선을 그려 라벨을 붙이는 방법은 무엇입니까? 내가 윤곽 플롯 다음 한

x <- c(0,25,50,75,100) 
y <- c(0,10,20) 
z <- matrix(c(12,12,13,12,5,12,5,5,5,12,5,12,13,14,15), nrow = 5, ncol = 3, byrow = TRUE) 
A <- matrix(seq(0, 100, by = 25), nrow = 3, ncol = 5, byrow = TRUE) #As x 
B <- matrix(seq(0,20, by = 10), nrow = 3, ncol = 5) #As y 
filled.contour(x,y,z, color=terrain.colors,# 
    plot.axes = { axis(1); axis(2); points(A,B)}) 

:

enter image description here

답변

1

당신은 수도를 plot.axescontour을 사용하십시오. 정확하게 5 줄을 추가 할 수 없으므로 대신 5.01을 사용하고 labels을 지정했습니다. 이것은 최소한 원칙입니다.

filled.contour(x, y, z, color = terrain.colors, 
       plot.axes = {axis(1); axis(2); points(A, B); 
       contour(x, y, z, levels = 5.01, labels = "5", col = "red", add = TRUE)}) 

enter image description here

0
library(fields) 
library(emdbook) 

x <- c(0,25,50,75,100) 
y <- c(0,10,20) 
z <- matrix(c(12,12,13,12,5,12,5,5,5,12,5,12,13,14,15), nrow = 5, ncol = 3, byrow = TRUE) 
A <- matrix(seq(0, 100, by = 25), nrow = 3, ncol = 5, byrow = TRUE) #As x 
B <- matrix(seq(0,20, by = 10), nrow = 3, ncol = 5) #As y 


image.plot(x,y,z) 
contour(x,y,z, 
    add=TRUE, lwd=2, cex=2) 
관련 문제