fill.contour 함수로 몇 개의 플롯을 만들었습니다. 그런 다음 두 개의 플롯을 서로 옆에 음모를 꾸미고 싶습니다. 따라서 grid.arrange 함수를 사용했습니다. 이 내 코드입니다 :grid.arrange with R Studio
install.packages("gridExtra")
install.packages("lattice")
install.packages("grid")
library(lattice)
library(gridExtra)
library(grid)
# Fake data
x <- c(1:10)
y <- c(1:10)
z<-matrix(data=c(1:100), nrow=10, ncol=10, byrow = FALSE)
p1<-filled.contour(x,y,z, color = terrain.colors, asp = 1) # simple
# Lay out both plots
grid.arrange(p1,p1, ncol=2)
하지만 내가 얻을 것은 :
이오류의 GList (목록 (wrapvp = 목록 (X = 0.5에서, y는 0.5 = 폭 = 1, 높이 = 1 : 경우에이 노력하는 이유 "의 GList"에
그게 전부 허용 'grobs'
install.packages("gridExtra")
install.packages("lattice")
install.packages("grid")
library(lattice)
library(gridExtra)
library(grid)
# Fake data (taken from the fill.contour help examples)
x <- c(1:10)
y <- c(1:10)
z<-matrix(data=c(1:100), nrow=10, ncol=10, byrow = FALSE)
p1<-filled.contour(x,y,z, color = terrain.colors, asp = 1) # simple
p1<-grob(p1)
is.grob(p1)
# Lay out both plots
grid.arrange(p1,p1, ncol=2)
그러나 이것은 작동하지 않습니다. 도와 줄수있으세요?
'filled.contour'는'lattice' 함수가 아닌 기본 그래픽 함수이며, grob 나 grob로 바뀔 수있는 객체를 생성하지 않습니다 (어쩌면 그것을 돌릴 수도 있지만 'gridBase' 패키지에있는 함수를 사용하여 grob에 저장). 'p1 <-filled.contour (x, y, z, color = terrain.colors, asp = 1)'을 입력하고'p1'을 입력하면 출력은'NULL'입니다. 'lattice'는 여러분이 필요로하는 것 같은 'contourplot'과'levelplot' 함수를 가지고 있습니다. – eipi10
또한 http://stackoverflow.com/questions/27929452/r-return-corrplot-as-object./#27948707을 참조하십시오. – user2957945
contourplot 및 levelplot의 문제점은 filled.contour와는 다른 입력이 필요하다는 것입니다. – rsl93