2013-03-22 1 views
1

와지도를 색칠 rr.txt는 다음과 같이 구성됩니다.R 내가 R과 SST (바다 표면 온도)를 그리려하지만 문제가</p> <p>을 여기서 새로운으로, 제발 말해, 라인에 약간의 오류가 아직 거기 윤곽

89 rows 180 cols means 2*2 grid data 

ee<-read.table("C:\\Users\\topmad\\Desktop\\New folder\\rr.txt") 
ee 
dim(ee) 
long<-seq(0,360,2) 
lati<-seq(0,180,2) 
m<-c(91:180, 1:90) 
m 
length(m) 

require(maps) 
maps::map(database="world", fill=TRUE, col="light blue") 
maps::map.axes() 
contour(long,lati,ee[,m], add=TRUE) 
par(ask=TRUE) 
+3

우리는 당신의 데이터도 어떤 결과가 보이는 않으며, 우리가 예상 한 결과가 어떻게 보일지 알 수가 없습니다. 작업을 재현하거나 결과에 대한 이미지와 같은 더 많은 정보를 제공하십시오. 우리가 당신을 도울 수 있도록 도와주세요. –

+0

미안 해요, 내 어머니의 음색이 영어가 아니므로 그림을 그리려는 실수가 틀림 없습니다. http://stackoverflow.com/questions/9172247/r-contour-map 나는 그 의미를 이해할 수 없습니다. 지도 윤곽 어떻게 데이터를 정렬? – TOPMAD

답변

3

문제는 귀하의 크기와 관련이 있습니다.

#Let's create some random values: 
ee<-array(rnorm(89*180),dim=c(89,180)) 

#If ee has 89 rows (corresponding to latitude I guess) then lati needs 89 values: 
lati <- seq(-90,90,length=89) #Latitudes goes from -90 to 90 as far as I know :) 
#Same thing with columns/longitude: 
long <- seq(-180,180,length=180) 

#you probably want your contour behind the continents so first an empty plot: 
plot(NA, xlim=c(-180,180), ylim=c(-90,90), xlab="", ylab="", xaxs="i", yaxs="i") 
#Then your contour (you need to transpose ee so that rows are longitudes): 
contour(long, lati, t(ee), add=TRUE) 
# And then your continents: 
maps::map(database="world", fill=TRUE, col="light blue", add=TRUE) 

enter image description here