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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:47:34+00:00 2026-06-03T04:47:34+00:00

I have created a graphing function: plotfun = function(dat, pos, tetrad.name=NULL, snp.cols=c(blue, red, lightgray)){

  • 0

I have created a graphing function:

plotfun = function(dat, pos, tetrad.name=NULL, snp.cols=c("blue", "red", "lightgray")){
    plot(1,1, type="n", xlim=c(min(pos), max(pos)), ylim=c(0.75,4.25), yaxt="n", xaxt="n", main=paste("CCT6 -",tetrad.name), xlab="", ylab="", bty="n", cex=.75)
    abline(h=1:4, lty="dotted")
    tmpnull = sapply(1:4, function(n) points(pos, rep((4:1)[n],length(pos)), col=snp.cols[dat[n,]], pch=16))
    mtext(c("a", "b", "c", "d"), side=2, line=0.5, at=4:1, las=1, cex=.5)
}

I am trying to use this graphing function to graph a subset of matrices that I have indexed from a larger list (x in this example). I am using sapply to graph all of the matrices individually:

sapply(1:69, function(n) plotfun(dat=matrix.transform(x[[n]]), pos=cct6.pos, tetrad.name= n ))

My problem is I can’t figure out how to have the plot title read as the list number attached to each matrix. Instead, it labels them 1:69, losing the information that from the indexed input. For example if the first input is cct6[[35]] I’d like the plot title to read "CCT6-35" not "CCT6-1"

Sorry if this is a basic question. I’m just stuck on this…

  • 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-03T04:47:35+00:00Added an answer on June 3, 2026 at 4:47 am

    Change your main= ... argument a line in the plot call within ‘plotfun’ with this snippet:

    main=bquote("CCT6-*.(tetrad.name))
    

    When I tried this with a simple test case I found that the lazy evaluation aspect resulted in (not an error but a failure to properly label the plots. Adding a force() cal fixed that issue. Compare these two:

    for(n in 1:2) plot(1,1,main=bquote("N="*.(n)))
    
    for(n in 1:2) {force(n); plot(1,1,main=bquote("N="*.(n)))}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have created a map that I'm trying to have function similar to 'My Maps'.
I have created the following C library for reading an image: typedef struct {
I have created a skin for DotNetNuke 5.x and I attempted to do as
I have created a basic site using ASP.NET routing according to Mike Ormond's example
I have created a simple test form with FormBorderStyle = FixedToolWindow by default and
I have created a file with XmlDocument xmldoc = new XmlDocument(); Can I make
i have created a simple public ref class in the vc++ project, which is
I have created one table using the below command: create table Table1( Id int
I have created an MS Access 2003 application, set up as a split front-end/back-end
I have created a mini installer in NSIS that installs patches for my application.

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.