Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6811029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:16:38+00:00 2026-05-26T20:16:38+00:00

With grid.arrange I can arrange multiple ggplot figures in a grid to achieve a

  • 0

With grid.arrange I can arrange multiple ggplot figures in a grid to achieve a multi-panel figure by using something like:

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

generate some ggplot2 plots , then

plot5 <- grid.arrange(plot4, plot1, heights=c(3/4, 1/4), ncol=1, nrow=2)

How can I obtain an ‘unbalanced’ 2 col layout with one plot in the entire first col and three plots in the second col?
I toyed with a ‘grid-of-grids’ approach by trying to use grid.arrange to plot one grid (e.g. plot5, above) against another plot, but obtained:

Error in arrangeGrob(…, as.table = as.table, clip = clip, main = main, :
input must be grobs!

Update:

Thanks for the advice. I will look into viewports and grid. In the meantime, thanks to @DWin, the layOut function in the ‘wq’ package worked very well for the compilation figure in my Sweave document:
enter image description here

Update 2:

The arrangeGrobcommand (as suggested by @baptiste) also works well, and seems very intuitive – at least it was easy to alter widths of the two columns. It also has the benefit of not requiring the `wq’ package.

e.g. Here is the code from my Sweave file:

<<label=fig5plot, echo=F, results=hide>>=
plot5<-grid.arrange(plot4, arrangeGrob(plot1, plot2, plot3, ncol=1), 
                    ncol=2, widths=c(1,1.2))
@
\begin{figure}[]
    \begin{center}
<<label=fig5,fig=TRUE,echo=T, width=10,height=12>>=
<<fig5plot>>
@
\end{center}
\caption{Combined plots using the `arrangeGrob' command.}
\label{fig:five}
\end{figure}

which produces the following output:
enter image description here

BTW, Anyone tell me why the ‘>NA’ appears?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:16:39+00:00Added an answer on May 26, 2026 at 8:16 pm

    grid.arrange draws directly on the device; if you want to combine it with other grid objects you need arrangeGrob, as in

     p = rectGrob()
     grid.arrange(p, arrangeGrob(p,p,p, heights=c(3/4, 1/4, 1/4), ncol=1),
                  ncol=2)
    

    Edit (07/2015): with v>2.0.0 you can use the layout_matrix argument,

     grid.arrange(p,p,p,p, layout_matrix = cbind(c(1,1,1), c(2,3,4)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a short routine which arranges ggplot and grid graphics using the grid.arrange
When trying to call grid.arrange to put multiple plots on a same ggplot2 graph,
I'd like to arrange a 3x3 grid layout over 3 pages of a PDF
I would like to arrange items of a collection in a grid with a
I'm trying to produce sheets of photographs with captions arranged in a grid using
What grid library does swivel.com use? It looks pretty nice. Is it made inhouse?
I have an ExtJS grid on a web page and I'd like to save
Infragistics Grid disappears when grid parent element is expanded/collapsed using JavaScript style.display property. When
I would like to arrange UIControls in WPF in a similar way to the
I have a grid view which is populated using a custom ImageAdapter class extending

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.