heatmap.2 how to remove row separator
1
0
Entering edit mode
@benoit-ballester-2259
Last seen 9.6 years ago
Hi, I am trying to plot a heatmap with heatmap.2, and would like not to plot any block separation for all rows, which is "white" by default. When I plot my heatmap as PDF (~9000 rows) I get all those fin white lines which dilutes the colors in my heatmap. A bit blurry in a way. I have played with those parameters, but with no luck so far. # block sepration colsep, rowsep, sepcolor="white", sepwidth=c(0.05,0.05), If any of you have an idea, or know how to deal with this, I'll be more than happy to hear about it. Thanks, Ben ( R-2.12.0 )
• 4.4k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
Hi Ben, On 2/23/2011 8:20 AM, Beno?t Ballester wrote: > Hi, > > I am trying to plot a heatmap with heatmap.2, and would like not to plot > any block separation for all rows, which is "white" by default. The default is to not draw separators. There will be some very thin white lines between the rows and columns, but this is due to how image() works (and in the end, heatmap.2 relies on image() to create the heatmap). For instance, try library(gplots) pdf("tmp.pdf", width=5, height=50) image(1:10, 1:1000, matrix(rnorm(10000), nrow=10), col=redgreen(25)) dev.off() Then zoom in on the resulting pdf. There will be some small white lines, but IMO they are very unobtrusive. Your other choice is to use levelplot() from lattice, but you will still get white lines: library(lattice) pdf("tmp2.pdf", width=5, height=50) levelplot(matrix(rnorm(10000), nrow=10), col=redgreen(100), colorkey=FALSE) dev.off() Best, Jim > > When I plot my heatmap as PDF (~9000 rows) I get all those fin white > lines which dilutes the colors in my heatmap. A bit blurry in a way. > > I have played with those parameters, but with no luck so far. > > # block sepration > colsep, > rowsep, > sepcolor="white", > sepwidth=c(0.05,0.05), > > If any of you have an idea, or know how to deal with this, I'll be more > than happy to hear about it. > > Thanks, > > Ben > > ( R-2.12.0 ) > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
ADD COMMENT
0
Entering edit mode
Hi James, James W. MacDonald wrote: > Then zoom in on the resulting pdf. There will be some small white lines, > but IMO they are very unobtrusive. Indeed this is exactly what I see, and I do find it annoying. Have a look at the links below. You'll notice the difference between PDF (with white lines) and PNG (I believe without) http://tinyurl.com/6yqcswr http://tinyurl.com/67wkbl3 > Your other choice is to use levelplot() from lattice, but you will still > get white lines: > > library(lattice) > pdf("tmp2.pdf", width=5, height=50) > levelplot(matrix(rnorm(10000), nrow=10), col=redgreen(100), colorkey=FALSE) > dev.off() > This seems to work slightly better. I'll give it a try... Ben
ADD REPLY
0
Entering edit mode
Dear Benoit in my experience this depends on the PDF viewer. For me, your PDF file http://tinyurl.com/6yqcswr shows a hint of those white lines in "Document Viewer 2.32.0", while it does not on "Adobe Reader 9.4.1" (both on Ubuntu). R's image function, on which these plots are based, is pretty peculiar - it draws each matrix element as a filled polygon. Recently, support for raster images was added to R devices, and this might be an alternative. E.g., for the case of levelplot: library("lattice") m = matrix(runif(10000), nrow=5) m[3,] = 0 col = heat.colors(100) pdf("tmp1.pdf", width=5, height=10) print(levelplot(m, col=col, aspect="fill")) dev.off() pdf("tmp2.pdf", width=5, height=10) print(levelplot(m, col=col, aspect="fill",panel= panel.levelplot.raster)) dev.off() tmp1.pdf has 594 kB and shows the white stripes in Document Viewer, while tmp2.pdf has 73 kB and does not show white stripes. Best wishes Wolfgang Beno?t Ballester scripsit 23/02/11 16:33: > Hi James, > > James W. MacDonald wrote: > >> Then zoom in on the resulting pdf. There will be some small white >> lines, but IMO they are very unobtrusive. > > Indeed this is exactly what I see, and I do find it annoying. Have a > look at the links below. You'll notice the difference between PDF (with > white lines) and PNG (I believe without) > > > http://tinyurl.com/6yqcswr > http://tinyurl.com/67wkbl3 > > > >> Your other choice is to use levelplot() from lattice, but you will >> still get white lines: >> >> library(lattice) >> pdf("tmp2.pdf", width=5, height=50) >> levelplot(matrix(rnorm(10000), nrow=10), col=redgreen(100), >> colorkey=FALSE) >> dev.off() >> > > This seems to work slightly better. > I'll give it a try... > > Ben > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor -- Wolfgang Huber EMBL http://www.embl.de/research/units/genome_biology/huber
ADD REPLY
0
Entering edit mode
Just for completeness, a small addition to the code example below: either the argument to the level.plot function should be 'col.regions=col', or it can be just omitted. This does not change any of the reasoning about little white lines or file sizes. Wolfgang Wolfgang Huber scripsit 25/02/11 16:11: > Dear Benoit > > in my experience this depends on the PDF viewer. For me, your PDF file > http://tinyurl.com/6yqcswr shows a hint of those white lines in > "Document Viewer 2.32.0", while it does not on "Adobe Reader 9.4.1" > (both on Ubuntu). > > R's image function, on which these plots are based, is pretty peculiar - > it draws each matrix element as a filled polygon. Recently, support for > raster images was added to R devices, and this might be an alternative. > E.g., for the case of levelplot: > > > library("lattice") > > m = matrix(runif(10000), nrow=5) > m[3,] = 0 > > col = heat.colors(100) > > pdf("tmp1.pdf", width=5, height=10) > print(levelplot(m, col=col, aspect="fill")) > dev.off() > > pdf("tmp2.pdf", width=5, height=10) > print(levelplot(m, col=col, aspect="fill",panel= panel.levelplot.raster)) > dev.off() > > > tmp1.pdf has 594 kB and shows the white stripes in Document Viewer, > while tmp2.pdf has 73 kB and does not show white stripes. > > Best wishes > Wolfgang > > Beno?t Ballester scripsit 23/02/11 16:33: >> Hi James, >> >> James W. MacDonald wrote: >> >>> Then zoom in on the resulting pdf. There will be some small white >>> lines, but IMO they are very unobtrusive. >> >> Indeed this is exactly what I see, and I do find it annoying. Have a >> look at the links below. You'll notice the difference between PDF (with >> white lines) and PNG (I believe without) >> >> >> http://tinyurl.com/6yqcswr >> http://tinyurl.com/67wkbl3 >> >> >> >>> Your other choice is to use levelplot() from lattice, but you will >>> still get white lines: >>> >>> library(lattice) >>> pdf("tmp2.pdf", width=5, height=50) >>> levelplot(matrix(rnorm(10000), nrow=10), col=redgreen(100), >>> colorkey=FALSE) >>> dev.off() >>> >> >> This seems to work slightly better. >> I'll give it a try... >> >> Ben >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor > > -- Wolfgang Huber EMBL http://www.embl.de/research/units/genome_biology/huber
ADD REPLY

Login before adding your answer.

Traffic: 431 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6