2013-06-22 3 views
0

데이터 집합 : 두 이변 량 불평등 관찰 :누락 값 - 폴라 플롯

d = read.table("D:/POLAR_1.txt", sep="\t", header=T) 
attach(d) 
summary(d) 
library(plotrix) 
par(mfrow=c(1,2)) 
:

g_d g_a s_d s_a 
2 27.75047815 2 27.75047815 
2 27.75047815 2 27.75047815 
3 27.75047815 2 27.75047815 
3 27.75047815 2 27.75047815 
3 27.75047815 2 27.75047815 
5 27.75047815 2 27.75047815 
6 27.75047815 2 27.75047815 
8 27.75047815 2 27.75047815 
9 27.75047815 2 27.75047815 
10 27.75047815 2 27.75047815 
3 17.19518769 2 27.75047815 
3 13.21767851 2 27.75047815 
4 13.21767851 3 27.75047815 
4 13.21767851 3 27.75047815 
5 13.21767851 3 27.75047815 
6 13.21767851 3 27.75047815 
6 13.21767851 3 27.75047815 
6 13.21767851 3 27.75047815 
7 13.21767851 3 27.75047815 
8 13.21767851 3 27.75047815 
9 13.21767851 3 27.75047815 
9 13.21767851 3 27.75047815 
11 13.21767851 3 27.75047815 
11 13.21767851  
14 13.21767851  
14 13.21767851  
14 13.21767851  
15 13.21767851  
16 13.21767851  
17 13.21767851  
24 13.21767851  
2 30.90877312  
2 30.90877312  
2 30.90877312  
2 30.90877312  
2 30.90877312  
3 30.90877312  
3 30.90877312  
3 30.90877312  

나는 다음과 같은 명령

코드를 사용하여 동일한 플롯 창에서 나란히 2 극성 플롯 측을 만들려고 노력하고 있어요

첫 번째 극좌표의 경우 :

polar.plot(NA, NA, clockwise=TRUE, rp.type="", start=90,radial.lim=c(0, 35), 
radial.cex=0.3, box.radial=TRUE, show.grid.labels=1, boxed.radial=FALSE) 

polar.plot(g_d, g_a, clockwise=TRUE, rp.type="s", start=90, point.symbols=19, 
show.grid.labels=3, par(cex=0.8), add=TRUE) 
극 줄거리를 들어

:

polar.plot(NA, NA, clockwise=TRUE, rp.type="", start=90,radial.lim=c(0, 35), 
radial.cex=0.3, box.radial=TRUE, show.grid.labels=1, boxed.radial=FALSE, add=TRUE) 

polar.plot(s_d, s_a, clockwise=TRUE, rp.type="s", start=90, point.symbols=19, 
show.grid.labels=3, par(cex=0.8), add=TRUE) 

결과 : 나는 1 음모를 얻을 수 있지만, 두 번째 음모에 대해 나는 다음과 같은 메시지가 점점 오전 :

오류 보고서 :

Error in if (grid.pos[1] < radial.lim[1]) grid.pos <- grid.pos[-1] : 
    missing value where TRUE/FALSE needed 

질문?

두 번째 데이터 집합에는 (관찰이 적기 때문에) 일부 누락 값이 있으므로이 오류가 발생합니다. 그래서,이 오류를 다루는 방법을 궁금해합니다.

+0

재현 예를 들어 사람들이 제안을 도움이 될 것이다. –

+0

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example –

+0

죄송합니다. 라이브러리를 추가하지 않았습니다. library (plotrix) – user2510725

답변

1

예를 들어이 시도 :

enter image description here

library(plotrix) 

par(mfrow=c(1,2)) 
polar.plot(NA, NA, clockwise=TRUE, rp.type="", start=90,radial.lim=c(0, 35), 
      radial.cex=0.3, box.radial=TRUE, show.grid.labels=1, boxed.radial=FALSE) 
polar.plot(g_d, g_a, clockwise=TRUE, rp.type="s", start=90, point.symbols=19, 
      show.grid.labels=3, par(cex=0.8), add=TRUE) 

## here remove add=TRUE  
polar.plot(NA, NA, clockwise=TRUE, rp.type="", start=90,radial.lim=c(0, 35), 
      radial.cex=0.3, box.radial=TRUE, show.grid.labels=1, boxed.radial=FALSE) 
## use na.omit to remove missing values 
polar.plot(na.omit(s_d), na.omit(s_a), clockwise=TRUE, rp.type="s", start=90, point.symbols=19, 
      show.grid.labels=3, par(cex=0.8), add=TRUE) 
+0

고맙습니다 - @agstudy . 방사형 축 (0 ~ 35)을 플롯 바깥에 배치 할 수있는 방법이 있습니까? 원형 축 값에 "Degree"기호를 위첨자로 넣으시겠습니까? – user2510725