2016-11-30 4 views
-1

분산 점의 모든 점에 변수와 연결된 국가 이름을 붙이려고하지만 모든 레이블이 아래쪽으로 이동합니다. 이 할 수있는 적절한 방법이 아니다 :'jittered'scatterplot에서 도트에 레이블을 지정하는 방법

plot(jitter(data$variable1,2), jitter(data$variable2,2), main = "Bivariate relationship between variable1 and variable2", xlim = c(0,100), ylim = c(0,100), xlab = "Variable 1", ylab = "Variable 2", col = "red", pch = 15) 

text(jitter(data$variable1,2), jitter(data$variable2,2), labels = data$Country) 

This is what the scatterplot looks like without labels 그리고 우리 셋은 다음과 같이이다 :

Country Variable1 Variable2 
France  2   2 
Turkey  1   3 
+0

당신이 사용중인 데이터, 전류 출력, 그리고 예상 출력의 샘플을 게시 할 수 있습니까? – BLT

+0

먼저 샘플 데이터를 입력하십시오 –

+0

죄송합니다. – Lezako

답변

0

이 귀하의 질문에 대답합니까?

Country=c("France", "Turkey") 
Variable1 = c(2, 1) 
Variable2 = c(2, 3) 
df = data.frame(Country, Variable1, Variable2) 
x1=jitter(Variable1, 2);x2=jitter(Variable2, 2) 
plot(x1, x2, xlim = c(min(x1)-1, max(x1)+1), ylim=c(min(x2)-1, max(x2)+1)) 
text(x1,x2, labels=df$Country, cex=.7, pos=3) 

enter image description here