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 8620317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:33:08+00:00 2026-06-12T06:33:08+00:00

I want to plot three graphs in a 1×3 layout. Only the first graph

  • 0

I want to plot three graphs in a 1×3 layout. Only the first graph needs to have vertical axis labels, but I want all three plot areas to be exactly the same size. This would be no problem if either none or all of the graphs had axis labels. But how do I get all three graphs the same size when one has axis labels and the other two don’t? I’m trying to do this in base graphics because that’s what I know best, but I’d be happy to use grid or ggplot2 if they provide better methods for solving my problem.

Here’s some fake data, my plotting code, and the plot itself:

# Fake Data
data = structure(list(y1 = 1:5, y2 = c(1.2, 2.4, 3.6, 4.8, 6), y3 = c(1.44, 
2.88, 4.32, 5.76, 7.2)), .Names = c("y1", "y2", "y3"), 
row.names = c("I needed 12 units for financial aid", 
              "I couldn't find any other open classes",
              "I might be adding a major or minor", 
              "The class seemed interesting", "The class fit into my schedule"
), class = "data.frame")

# Plotting code
par(mar=c(5,15,4,1))
par(mfrow=c(1,3))
barplot(data$y1,names.arg=row.names(data), horiz=TRUE,las=1, +
        xlim=c(0,8), main="Group 1")
par(mar=c(5,1,4,1))
barplot(data$y2,names.arg=row.names(data), horiz=TRUE,las=1, +
        axisnames=FALSE, xlim=c(0,8), main="Group 2")
barplot(data$y3,names.arg=row.names(data), horiz=TRUE,las=1, +
        axisnames=FALSE, xlim=c(0,8), main="Group 3")

# Reset plot options back to defaults
par(mfrow=c(1,1)
par(mar=c(5,4,4,2)+0.1)

[Update: I chose the answer that most directly answered my question, which was in base graphics, but I recommend looking at the other solutions as well, as they show how to do the same thing in lattice and ggplot2.]

enter image description here

  • 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-12T06:33:09+00:00Added an answer on June 12, 2026 at 6:33 am

    For base graphics you want to use an outer margin rather than the regular margins. Just replace the first par(mar=c(5,15,4,1)) with par(oma=c(0,15,0,0)) and remove the second call to par and the plots will take equal space (and the axis labels will stick into the outer margin on the left).

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

Sidebar

Related Questions

I have created a scatter graph with three plot spaces. One for two y-axis
I have the data in two files. I want to plot a graph the
With this approach. I have a line plot graph. I want to plot 'two'
I want to plot three graphs in one plot: upper quartile, median, and lower
I want to plot multiple rowstacked histograms on the same graph using gnuplot. A
I have a data which I want to plot in cumulative function. The R
I have a vectors of strings, say c(E^A,S^P,lambda,T,E^Q,E^Q,AT) , and I want to plot
I want to plot some data into a web graph control(preferably javascript or php).
I'm (trying to) using JSON with PHP. I want to plot a graph using
I've following data: I want to plot a graph shows for all x the

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.