2012-03-25 4 views
2

나는 명령R : boxplot에서 라벨 이름을 공유하는 방법은 무엇입니까?

boxplot(tstats,names=c(expression(bar(x)),"","med(x)","","mad(x)","", 
     var(x)","",expression(q[.75]-q[.25]),""), 
     col=rep(c("wheat","chocolate"),5)) 
abline(h=2,col="steelblue",lty=2) 
abline(h=-2,col="steelblue",lty=2) 
title(main="normal data") 

다음과 같은 그래프 enter image description here

을했다하지만 난이 (밀가루와 초콜릿) 상자 사이에 공유 이름을 가운데로 대신하고 싶습니다. 첫 번째 축 레이블은 어떻게 수정합니까? 이 같은

답변

4

뭔가 당신이 원하는 것을 수행해야합니다

##Some dummy data 
dd = data.frame(values = rnorm(40), type=LETTERS[1:4]) 

##Don't plot the axes labels 
##but add in the "plot frame" 
boxplot(dd$values ~ dd$type, axes=FALSE, 
        frame.plot=TRUE, ylim=c(-4, 4)) 

##Now add in the y-axis 
axis(2, seq(-4,4,by=2)) 
##Add in the x-axis at points: 1.5 and 3.5 
axis(1, c(1.5,3.5), c("Med", "Mad")) 
+0

감사합니다, 그게 내가 필요로하는 모든입니다! –

관련 문제