Colin Ford
2011-Aug-08 10:48 UTC
[R] heatmap is producing unwanted horizontal and vertical lines?
Hello, I must start by saying that I am an R novice and am sorry if this is a no-brainer... I have an csv file that contains a grid of 300x300 data points. Each point represents a 1Km square on a map. Each point is either a floating point number or NA. I load the data in with: data <- read.csv("matrix.csv", sep=',') Convert the data to a matrix with: data_matrix <- data.matrix(data) and then produce the heatmap with: data_heatmap <- heatmap(data_matrix,Rowv=NA,Colv='Rowv',margin=c(0,0)) The heatmap is displayed in a separate window as expected and looks correct apart from fine white banding lines spaced out evenly over the image running horizontally across the image? At first I thought it was my data but I checked that and its not. If I resize the image I then see white vertical lines and different horizontal lines appear? I've tried a number of different settings but can't seem to get rid of these lines. If I can get rid of them the image will be ideal and just what I want. Does anyone have any idea of what I'm doing wrong? Best regards, Col. [[alternative HTML version deleted]]
Colin Ford
2011-Aug-08 15:53 UTC
[R] heatmap is producing unwanted horizontal and vertical lines?
Hi Pete, I thought it might be something to do with NA's when I first started but its not. I've attached both the image output and the data. Its almost as if the blocks in the heatmap are not quite meshing together? I've tried heatmap.2 as well and that gave the same result. I also just tried the image command and that was giving the same result as well.? What I'm wanting are blocks together without the white lines going through but just cant seem to find a way to do that? Best regards, Col. ________________________________ From: Peter Morgan <MorganPH at cardiff.ac.uk> To: Colin Ford <col_ford at yahoo.com> Sent: Monday, 8 August 2011, 14:37 Subject: Re: [R] heatmap is producing unwanted horizontal and vertical lines? Hi Col, Without seeing your data and the heatmap you are plotting it is hard to tell what is going on. Are the NAs in any pattern? ?NAs appear in heatmap as the background colour which is white by default since they are plotted transparently (see the image( ) command for details). If this is the case, you could be seeing the pattern of NAs plotted in white. ? Also, have you tried the the heatmap.2( ) option in gplots? Regards, Pete From: ? ? ? ?Colin Ford <col_ford at yahoo.com> To: ? ? ? ?"r-help at r-project.org" <r-help at r-project.org> Date: ? ? ? ?08/08/2011 13:05 Subject: ? ? ? ?[R] heatmap is producing unwanted horizontal and vertical lines? Sent by: ? ? ? ?r-help-bounces at r-project.org ________________________________ Hello, I must start by saying that I am an R novice and am sorry if this is a no-brainer... I have an csv file that contains a grid of 300x300 data points. Each point represents a 1Km square on a map. Each point is either a floating point number or NA. I load the data in with: ? data <- read.csv("matrix.csv", sep=',') Convert the data to a matrix with: ? data_matrix <- data.matrix(data)? and then produce the heatmap with: ??data_heatmap <- heatmap(data_matrix,Rowv=NA,Colv='Rowv',margin=c(0,0)) The heatmap is displayed in a?separate?window as expected and looks correct apart? from fine white banding lines spaced out evenly over the image running horizontally? across?the image? At first I thought it was my data but I checked that and its not. If I resize the image I then see white vertical lines and?different?horizontal lines appear? I've tried a number of?different?settings but can't seem to get rid of these lines. If I can get rid of them the image will be ideal and just what I want. Does anyone have any idea of what I'm doing wrong? Best regards, Col. ? ? ? ? ? ? ? ? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list 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.