Heatmap cannot be plotted

Open
#95 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
r

Research direction

Start by reproducing the tutorial's two heatmap.3 calls with the shown CNA.test and tumor.mat inputs, then inspect whether the matrices passed to heatmap.3 are numeric and whether the plotting device can accommodate the requested margins. Done means both tutorial heatmaps render without the numeric-matrix or figure-margins errors.

Written by the indexing model from the issue text.

Description

Hi, I am using the code provided in the tutorial and cannot to generate both heatmaps using the following code

heatmap.3(t(as.matrix(CNA.test[,4:ncol(CNA.test)])),dendrogram="r", distfun = function(x) parallelDist::parDist(x,threads =4, method = "euclidean"), hclustfun = function(x) hclust(x, method="ward.D2"),
            ColSideColors=chr1,RowSideColors=cells,Colv=NA, Rowv=TRUE,
            notecol="black",col=my_palette,breaks=col_breaks, key=TRUE,
            keysize=1, density.info="none", trace="none",
            cexRow=0.1,cexCol=0.1,cex.main=1,cex.lab=0.1,
            symm=F,symkey=F,symbreaks=T,cex=1, cex.main=4, margins=c(10,10))

  legend("topright", paste("pred.",names(table(com.preN)),sep=""), pch=15,col=RColorBrewer::brewer.pal(n = 8, name = "Dark2")[2:1], cex=0.6, bty="n")


The error shows:

Error in heatmap.3(t(as.matrix(CNA.test[, 4:ncol(CNA.test)])), dendrogram = "r", :
`x' must be a numeric matrix

I also tried code to plot tumor heatmap:

heatmap.3(t(tumor.mat),dendrogram="r", distfun = function(x) parallelDist::parDist(x,threads =4, method = "euclidean"), hclustfun = function(x) hclust(x, method="ward.D2"),
            ColSideColors=chr1,RowSideColors=cells,Colv=NA, Rowv=TRUE,
            notecol="black",col=my_palette,breaks=col_breaks, key=TRUE,
            keysize=1, density.info="none", trace="none",
            cexRow=0.1,cexCol=0.1,cex.main=1,cex.lab=0.1,
            symm=F,symkey=F,symbreaks=T,cex=1, cex.main=4, margins=c(10,10))

  legend("topright", c("c1","c2"), pch=15,col=RColorBrewer::brewer.pal(n = 8, name = "Dark2")[3:4], cex=0.9, bty='n')


Another error occurs: Error in plot.new() : figure margins too large

Can you help?

Dominant language
R
Stars
305
Forks
66
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from navinlabcode/copykat

All issues in navinlabcode/copykat

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.