Question: How to add a autoplot into grid.arrange
1
gravatar for Kousik
3.5 years ago by
Kousik10
Germany
Kousik10 wrote:

Hi,

  I am facing difficulties to add an autoplot into grid.arrange. Please go through below mentioned code:

library(ggplot2)
library(grid)
library(gridExtra)

library(ggbio)
library(Homo.sapiens)

 

p1 <- ggplot(df1, aes(x=Start, y=Log2RPM, group=Genotype)) +
geom_line(aes(colour = Genotype), size=1) +
facet_grid(Tag ~ .)

gene <- GRanges("chr10", IRanges(81035775, 81047732))

p2<- autoplot(Homo.sapiens, which = gene)

grid.arrange(p1, p2, nrow = 2 )

%%%%%%%%%%% Getting error: %%%%%%%%%%

Error in gList(list(grobs = list(list(x = 0.5, y = 0.5, width = 1, height = 1,  :
  only 'grobs' allowed in "gList"
In addition: Warning message:
In class(grob) <- c("gTableChild", class(grob)) :
  Setting class(x) to multiple strings ("gTableChild", "GGbio", ...); result will no longer be an S4 object

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Any help will be appreciated...

-Kousik

 

 

 

 

autoplot ggplot2 grid.arrange • 2.3k views
ADD COMMENTlink written 3.5 years ago by Kousik10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 819 users visited in the last hour