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

  • Home
  • SEARCH
  • 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 8457411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:48:02+00:00 2026-06-10T12:48:02+00:00

the following example creates a ggplot with the 4 panels A, B, C, D

  • 0

the following example creates a ggplot with the 4 panels “A”, “B”, “C”, “D” in one row.

I figured out how to plot these 4 panels in one column. However, what still remains a mystery is how to arrange the 4 panels so that “A” and “B” are in the first row and “C” and “D” are put in a separate (second) row?

Here’s my code:

df <- data.frame(
x = rep(rep(1:10, each=10), 2),
y = rep(rep(1:10, 20), 2),
grid = rep(LETTERS[1:4], each=100)
)

ggplot(df, aes(x = x, y = y)) +
geom_point() +
facet_grid(. ~ grid, scales = "free")
  • 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-06-10T12:48:03+00:00Added an answer on June 10, 2026 at 12:48 pm

    Use facet_wrap instead of facet_grid:

    library(ggplot2)
    ggplot(df, aes(x = x, y = y)) +
      geom_point(aes(colour=grid)) +
      facet_wrap(~ grid, scales = "free")
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following this example to create polygons to plot using ggplot I am
In the following example i can create an object dynamically via a string; however,
I'm following OpenSSL multi-threaded server example but this example creates zoombie processes. I researched
I have the following code example for Visual C++ which creates an ActiveX object
How do I convert the following example to use one of the wicket/IOC integration
Let's consider the following example. I have a parent process that creates a pipe,
I am trying to create dynamic menus from the database using the following example
following some example from Microsoft I created my custom MembershipProvider in my MVC application
I am following this example (First comment), How to create a custom ListView with
Please forgive the verbosity of the following code example. Using Delphi 2009, I created

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.