2013-08-04 2 views
1

다음 플롯이 R에 있습니다. 기존 플롯 양식 x =[0, 2]y=[0, 2]에 서브 플롯을 만들고 싶습니다. 서브 플롯을 확대하고 싶습니다. R에서 이것을 어떻게 할 수 있습니까?기존 플롯의 서브 플롯 확대 R

lin <- data.frame(x = c(0:6), y = c(0.3, 0.1, 0.9, 3.1, 5, 4.9, 6.2)) 
linm <- lm(y ~ x, data = lin, subset = 2:4) 
plot(y ~ x, data = lin) 
abline(linm) 
+0

[관련] (http://stackoverflow.com/questions/13714724/how-to-draw-a -zoom-in-effect-in-r/13728281) 질문, 답변, 의견 .. – Julius

+0

@Julius. 저는 그 질문을 보았습니다. 그러나 그 점은 라인이 아닌 포인트를 줌하는 것입니다. – rose

답변

2

플롯 기능에 대한 xlim 및 ylim 인수를 사용하여 플롯의 한계를 변경할 수 있습니다. 예를

plot(y~x, data = lin, xlim=c(0,2), ylim=c(0,2)) 
4

를 들어 당신은 예를 들어,이 작업을 수행 할 수 있습니다

lin <- data.frame(x = c(0:6), y = c(0.3, 0.1, 0.9, 3.1, 5, 4.9, 6.2)) 
linm <- lm(y ~ x, data = lin, subset = 2:4) 
plot(y ~ x, data = lin) 
abline(linm) 
## to overlap the 2 plots 
par(new=TRUE, oma=c(3,1,1,2)) 
## create a layout to plot the subplot in the right bottom corner 
layout(matrix(1:4,2)) 
## use xlim and ylim to zoom the subplot 
plot(y ~ x, data = lin,xlim=c(0,2), ylim=c(0,2)) 
abline(linm) 

enter image description here

+0

감사합니다. 이 서브 플롯은 괜찮지 만 어떻게이 서브 플롯을 확대하거나 더 크게 만들 수 있습니까? – rose