Hi I am trying to understand what happen with the heatmap.2 code that it used to work (last used in October 2015). I am able to get a heatmap but my colour key doesn't come up and instead I get an error in all my files the used to work. Does anyone has any idea of what could have changed? or how to fix this. Thanks. # Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/100)) : wrong sign in 'by' argument In addition: Warning message: In image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : unsorted 'breaks' will be sorted before use ## library("RColorBrewer") library("gplots") library ("gtools") GO_Fil=read.table("1h-6h-up-down-v4.csv", sep=",", header=T) data =data.matrix (GO_Fil[,3:4]) # define which columns to use for the heatmap rownames(data) <- GO_Fil$Description summary (data) pairs.breaks <- c(seq(-6, -0.01, length.out=50), seq(-0.02, 0.01,length.out=150), seq(0.02, 3.9,length.out=80)) hmcols<- colorRampPalette(c("blue","white", "red"))(length(pairs.breaks)-1) pdf("Heat_1hv6h-updown-key.pdf", width = 15, height = 20, pointsize = 5) hm<- heatmap.2(data, breaks=pairs.breaks, col=hmcols, na.color="white", trace="none",Colv=FALSE, dendrogram = "none", density.info="none", key="TRUE", keysize = 2, key.xlab = "Log2FC", key.title = "key", cexCol=3.0, cexRow=2, lwid= c(0.4,1), lhei = c(0.1, 4), margins= c(50,80), symm=F,symkey=F,symbreaks=T, scale="none") dev.off()> R.version_ platform x86_64-apple-darwin13.4.0 arch x86_64 os darwin13.4.0 system x86_64, darwin13.4.0 status major 3 minor 2.2 year 2015 month 08 day 14 svn rev 69053 language R version.string R version 3.2.2 (2015-08-14) [[alternative HTML version deleted]]
Data? Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html John Kane Kingston ON Canada> -----Original Message----- > From: catagui at gmail.com > Sent: Tue, 19 Apr 2016 09:35:14 +1000 > To: r-help at r-project.org > Subject: [R] heatmap2 error key > > Hi I am trying to understand what happen with the heatmap.2 code that it > used to work (last used in October 2015). I am able to get a heatmap but > my > colour key doesn't come up and instead I get an error in all my files the > used to work. Does anyone has any idea of what could have changed? or how > to fix this. > > Thanks. > > # > > Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/100)) : > wrong sign in 'by' argument > In addition: Warning message: > In image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : > unsorted 'breaks' will be sorted before use > > ## > > library("RColorBrewer") > library("gplots") > > library ("gtools") > > GO_Fil=read.table("1h-6h-up-down-v4.csv", sep=",", header=T) > > data =data.matrix (GO_Fil[,3:4]) # define which columns to use for the > heatmap > > rownames(data) <- GO_Fil$Description > > summary (data) > > pairs.breaks <- c(seq(-6, -0.01, length.out=50), seq(-0.02, > 0.01,length.out=150), seq(0.02, 3.9,length.out=80)) > > hmcols<- colorRampPalette(c("blue","white", > "red"))(length(pairs.breaks)-1) > > pdf("Heat_1hv6h-updown-key.pdf", > width = 15, > height = 20, > pointsize = 5) > > hm<- heatmap.2(data, breaks=pairs.breaks, col=hmcols, na.color="white", > trace="none",Colv=FALSE, > dendrogram = "none", > density.info="none", > key="TRUE", > keysize = 2, > key.xlab = "Log2FC", > key.title = "key", > cexCol=3.0, > cexRow=2, > lwid= c(0.4,1), > lhei = c(0.1, 4), > margins= c(50,80), > symm=F,symkey=F,symbreaks=T, scale="none") > > dev.off() > >> R.version > _ > platform x86_64-apple-darwin13.4.0 > arch x86_64 > os darwin13.4.0 > system x86_64, darwin13.4.0 > status > major 3 > minor 2.2 > year 2015 > month 08 > day 14 > svn rev 69053 > language R > version.string R version 3.2.2 (2015-08-14) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account.
Hi Catalina, The error message is pretty clear. min(diff(breaks)/100) evaluates to a negative number. Perhaps the sort order for the values in "breaks" has changed. Jim On Tue, Apr 19, 2016 at 9:35 AM, Catalina Aguilar Hurtado <catagui at gmail.com> wrote:> Hi I am trying to understand what happen with the heatmap.2 code that it > used to work (last used in October 2015). I am able to get a heatmap but my > colour key doesn't come up and instead I get an error in all my files the > used to work. Does anyone has any idea of what could have changed? or how > to fix this. > > Thanks. > > # > > Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/100)) : > wrong sign in 'by' argument > In addition: Warning message: > In image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : > unsorted 'breaks' will be sorted before use > > ## > > library("RColorBrewer") > library("gplots") > > library ("gtools") > > GO_Fil=read.table("1h-6h-up-down-v4.csv", sep=",", header=T) > > data =data.matrix (GO_Fil[,3:4]) # define which columns to use for the > heatmap > > rownames(data) <- GO_Fil$Description > > summary (data) > > pairs.breaks <- c(seq(-6, -0.01, length.out=50), seq(-0.02, > 0.01,length.out=150), seq(0.02, 3.9,length.out=80)) > > hmcols<- colorRampPalette(c("blue","white", "red"))(length(pairs.breaks)-1) > > pdf("Heat_1hv6h-updown-key.pdf", > width = 15, > height = 20, > pointsize = 5) > > hm<- heatmap.2(data, breaks=pairs.breaks, col=hmcols, na.color="white", > trace="none",Colv=FALSE, > dendrogram = "none", > density.info="none", > key="TRUE", > keysize = 2, > key.xlab = "Log2FC", > key.title = "key", > cexCol=3.0, > cexRow=2, > lwid= c(0.4,1), > lhei = c(0.1, 4), > margins= c(50,80), > symm=F,symkey=F,symbreaks=T, scale="none") > > dev.off() > >> R.version > _ > platform x86_64-apple-darwin13.4.0 > arch x86_64 > os darwin13.4.0 > system x86_64, darwin13.4.0 > status > major 3 > minor 2.2 > year 2015 > month 08 > day 14 > svn rev 69053 > language R > version.string R version 3.2.2 (2015-08-14) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.