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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:06:27+00:00 2026-06-05T02:06:27+00:00

In order to generate a layout with multiple plots, I have the following code

  • 0

In order to generate a layout with multiple plots, I have the following code with some dummy plots:

jpeg("/path/to/file",height=10000,width=5000)
plot.new()
par(mar=c(2,2,1,1), oma=c(2,4,0,0), xpd=NA)

for (i in 1:10) {

    par(mar=c(2,2,1,1),fig=c(0, 0.5, (10-i)/10, (11-i)/10), new=T)    
    matplot(rnorm(20)*sample(100,1),                                          
        col="blue",axes=F,type="l",lwd=10, xlab="",ylab="")

    par(mar=c(2,2,1,1),fig=c(0.5, 1, (10-i)/10, (11-i)/10), new=T)    
    matplot(rnorm(20)*sample(100,1),                                          
        col="red",axes=F,type="l",lwd=10, xlab="",ylab="")    
}
dev.off()

I want to add a vertical line/axis on the far LHS and the far RHS that span all 10 plots in a column. Since I will use this line as an axis, I need to be able to add ticks and labels.

  • 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-05T02:06:29+00:00Added an answer on June 5, 2026 at 2:06 am

    You could draw axis by ?axis or ?Axis. To span your axis on multiple plots you have to reset the usr coordinates.

    Please find a base graphics solution below:

    ## store number of rows
    nRow <- 10
    
    ## your example code 
    ## (only the number "10" is replaced by nRow and oma is adapted)
    plot.new()
    
    par(mar=c(2, 2, 1, 1), oma=c(2, 4, 0, 4), xpd=NA)
    
    for (i in 1:nRow) {
    
        par(mar=c(2, 2, 1, 1), fig=c(0, 0.5, (nRow-i)/nRow, ((nRow+1)-i)/nRow), new=TRUE)    
        matplot(rnorm(20)*sample(100, 1),                                          
                col="blue", axes=F, type="l", lwd=10, xlab="", ylab="")
    
        par(mar=c(2, 2, 1, 1), fig=c(0.5, 1, (nRow-i)/nRow, ((nRow+1)-i)/nRow), new=TRUE)
        matplot(rnorm(20)*sample(100, 1),                                          
                col="red", axes=F, type="l", lwd=10, xlab="", ylab="")    
    }
    
    ## define new user coordinates
    usr <- c(0, 1, 0, 1) ## x1, x2, y1, y2
    
    ## calculate tick positons
    ## in general: (usr[3]+(diff(usr[3:4])/(nRow-1))*0:(nRow-1))
    ## but our usecase is much easier:
    ticksAt <- 1/(nRow-1)*0:(nRow-1)
    
    ## choose left column and reset user plotting area (usr)
    par(mar=c(2, 2, 1, 1), fig=c(0, 0.5, 0, 1), usr=usr, new=TRUE)
    ## draw axis; see ?Axis for details
    Axis(side=2, at=ticksAt, labels=as.character(1:(nRow)), line=0.5)
    
    ## choose right column and reset user plotting area (usr, not needed because already done)
    par(mar=c(2, 2, 1, 1), fig=c(0.5, 1, 0, 1), usr=usr, new=TRUE)
    ## draw axis; see ?Axis for details
    Axis(side=4, at=ticksAt, labels=as.character((nRow+1):(2*nRow)), line=0.5)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started to use ggplot in order to generate some graphs. I am using
I have a order list and I want to generate and rank the product
I need to analyze some C++ source files in order to generate some very
I am using html2pdf library in order to generate pdf from html file. I
I'm using this code in order to generate XML from my grid's cells values:
I'm using the following code to generate a list of all wordpress blogs in
I wish to generate rays from the camera through the viewing plane. In order
I'm trying to dynamically generate QR codes for my thermal printer. In order to
I'm trying to use XSL-stylesheets in order to transform some generated XML-data to HTML-output.
Order by descending is not working on LINQ to Entity In the following Query

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.