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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:48:46+00:00 2026-05-27T09:48:46+00:00

I’m using R to create a heatmap from a matrix using heatmap.2 – and

  • 0

I’m using R to create a heatmap from a matrix using heatmap.2 – and i want to group these images into one big image – What i usually use to achieve this is layout() – but this doesn’t work, as heatmap.2 uses layout, and apparently layout does not work recursively.

Does anyone have any suggestions on how to group together 2 images without layout, or how to make layout support recursive calls?

mat = matrix(nrow=3,nrow=3,1:9)
layout(matrix(nrow=2,ncol=1))
heatmap.2(mat) ## overrides the layout and produces only one plot that takes whole screen
heatmap.2(mat) ## still only one image

thanks.

  • 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-27T09:48:46+00:00Added an answer on May 27, 2026 at 9:48 am

    What follows is a hack that is almost certainly not a perfect solution, but it may get you started.

    Create your own version of the heatmap.2 function called hm3. In the code for hm3, comment out all the lines between:

     if (missing(lhei) || is.null(lhei))
    

    and the layout call:

    layout(lmat, widths = lwid, heights = lhei, respect = FALSE)
    

    it’s a big chunk of code, maybe 30 lines. Now the following code produces two heat maps with dendrograms and keys side by side:

    x  <- as.matrix(mtcars) 
    lhei <- c(1.5, 4,1.5,4)
    lwid <- c(1.5, 4,1.5,4)
    layout(rbind(c(4,3,8,7),c(2,1,6,5)), 
        widths = lwid, heights = lhei, respect = FALSE)
    hm3(x)
    hm3(x)
    

    enter image description here

    Clearly, this will require considerable tweaks to make it look nice (and a larger plotting area; I’ve squished everything to be a reasonable size to post here).

    This is entirely untested. It is likely that using any of the options in the hm3 function that control the appearance of the plot will cause things to go slightly haywire. But this may be a good starting point for your own experimentation to address those issues.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I am reading a book about Javascript and jQuery and using one of the
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

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.