2016-11-18 1 views
0

내가 재현 가능한 예제를 따르면 35 개의 차트 목록을 얻은 다음 4 개 그룹으로 표시하고 싶습니다. mfrow를 사용했지만 이전에는 차트를 표시하는 명령을 실행할 때 전체 화면을 단일 차트로 덮어 씁니다. 도울 수 있니 ? ggplot와 한 가지 내가 scales = "free_y"을 사용이 매우 혼잡 되었기 때문에 theme()으로 X-라벨을 제거차트 패널에 더 많은 차트 표시 (목록에서)

ggplot(diamonds,aes(x=clarity,fill=clarity)) + geom_bar() + 
    facet_grid(cut~color,scales = "free_y") + 
     theme(axis.title.x=element_blank(), axis.text.x=element_blank())  

주 패싯에

library(tidyverse) 
x<-split(diamonds, with(diamonds, interaction(cut,color)), drop = TRUE) 

graphs<-list() 
for (i in 1:length(x)) 
    local({ 
    i<-i 
    chart<-print(ggplot(x[[i]],aes(x=clarity,fill=clarity))+ 
        geom_bar()) 

    graphs[[i]]<<-chart 
    i=i+1 
    print(i) 
    }) 

par(mfrow=c(2,2)) 
graphs[[1]] 
graphs[[2]] 
graphs[[3]] 
graphs[[4]] 
+1

'grid' 패키지,'gridExtra' 또는'cowplot'을보십시오 –

답변

1

이 가능합니다.

+1

당신은'scales = "free_y"'를 의미 했습니까? –

+0

예, "free_y"여야합니다. 감사. – Martin