Re: [R] heatmap ploting

2021-11-05 Thread Jim Lemon
Hi Steve,
That plot looks to me as though a value-to-color transformation is
performed on the logarithm of gene expression. The scale bar can be
roughly reproduced like this:

library(plotrix)
plot(0,xlim=c(0,3))
gradient.rect(0,-0.1,3,0.1,
 col=color.scale(seq(0,3,0.1),
 c(0.7,1,1,1,0.7,0.2),
 c(0.7,1,0,0,0,0),
 c(1,0,0,0.1,0.7,0.2)))
text(0:3,rep(0.2,3),c(0,10,100,1000))

The horizontal lengths of the stacked bars of the plot can then be
adjusted to the number of subjects in a given bin of log gene
expressions. A tricky plot, but it can be done in R.

Jim

On Fri, Nov 5, 2021 at 6:08 PM Stephen HonKit Wong  wrote:
>
> Dear Community,
>
> I have an example heatmap plot in this link
> 
> which was generated by java I believe, I want to make a similar plot in R.
> Any clues on how to do it? Thanks.
>
> The column is a gene, and the rows are different cancer types with
> different numbers of patients. The heatmap value represents the expression
> value, such as FPKM, which can range from 0 to over several hundreds.
>
>
> Much thanks!
>
> Steve
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.


Re: [R] Heatmap

2019-10-21 Thread Rui Barradas

Hello,

Just do col = rev(heat.colors(256)) ?

Hope this helps,

Rui Barradas

Às 12:55 de 21/10/19, Eleftheria Dalmaris escreveu:

Hello all,

I have made the attached heat map without a problem.

On this heat map, the yellows are my high values and the oranges are my low
values. Is there a way to change that? Where the orange color is to have
the yellow and vice versa?

Thanks a lot,

Eleftheria

P.S.
In case is needed here is the code:
data_heatmap <- heatmap(data_matrix, Rowv=NA, Colv=NA, col =
heat.colors(256), scale="column",
cexCol = 1.5, cexRow = 0.5, margins=c(0.5,5))


__
R-help@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.



__
R-help@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.


Re: [R] heatmap.2, adding a legend at bottom

2018-10-04 Thread Ding, Yuan Chun
Hi David,

Thank you so much!!  Problem resolved. xpd=TRUE does the trick to put a legend 
outside.

Ding

-Original Message-
From: David L Carlson [mailto:dcarl...@tamu.edu] 
Sent: Thursday, October 04, 2018 12:09 PM
To: Ding, Yuan Chun; r-help@r-project.org
Subject: RE: heatmap.2, adding a legend at bottom

It will take a bit of trial and error. Use this example as a guide. You will 
probably have to set the y coordinate to a negative value and include xpd=TRUE:

> data(mtcars)
> x  <- as.matrix(mtcars)
> heatmap.2(x)
> legend(.5, -.1, "Legend", xpd=TRUE)


David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77843-4352

-Original Message-
From: R-help  On Behalf Of Ding, Yuan Chun
Sent: Thursday, October 4, 2018 1:19 PM
To: r-help@r-project.org
Subject: Re: [R] heatmap.2, adding a legend at bottom


Hi All,

I generated the attached heatmap using the following  R code and attached 
testfile.

I tried to move the legend to the bottom, Can anyone help me?  I have played 
for 3 hours and can not resolve the problem.

I realized that in the last email, I forgot to include the "Group" variable for 
legend. I added to the R code below.

Thank  you,

Ding



png("heatmaps_test2.png",   # create PNG for the heat map
width = 5*300,# 5 x 300 pixels
height = 5*300,
res = 300,# 300 pixels per inch
pointsize = 8  # smaller font size
)

# lmat = rbind(c(0,0,4),c(3,1,2),c(0,0,5))
# #1.  RowSideColors;2.Heatmap;3.Row tree;4.Column tree;5.Color key
# lwid = c(0.8,0.15,7) # lwid controls the column width # lhei = c(0.1,5.5,1) 
#lhei controls the row height


my_palette2 <- colorRampPalette(c("blue", "cyan4", "red"))(n = 299) col_breaks 
= c(seq(-1.5,-1.1,length=100), # for bllue
   seq(-1.099,1.099,length=100),  # for green
   seq(1.1,1.5,length=100)) # for red cols <- c("red", "black", 
"blue") heatmap.2(as.matrix(testfile), key=T,
  #lmat=lmat, lwid=lwid, lhei=lhei,
  symkey=FALSE,#keysize=1, key.par =list(cex=0.25),
  key.xlab="Heatmap color key",
  key.title =" ",
  RowSideColors= cols[as.numeric(as.factor(allinfo.blood$Group))],
  density.info="none",  # turns off density plot inside color legend
  trace="none", # turns off trace lines inside the heat map
  col=my_palette2, # use color palette defined earlier
  breaks=col_breaks,
  cexRow=1.4,
  labCol=" ", # default to colnames(x)
  #labRow=" ",
  #margins =c(12,9),
  #Colv="NA", # only draw a row dendrogram
  hclust=function(x) hclust(x,method="complete"),
  distfun=function(x) as.dist((1-cor(t(x)))/2)
  ) # using pearson correlation as distance

Group <-c("Blood: Vector", "Blood: Vector", "Blood: E2", "Blood: E2",
"Blood: E2+BP3",  "Blood: E2+BP3",  "Blood: Vector",  "Blood: Vector",
"Blood: E2", "Blood: E2", "Blood: E2+BP3",  "Blood: E2+BP3")

 groups = levels(as.factor(Group))
legend(0.2,0.1, groups, col=cols, pch=15, ncol = 3, cex=1)
dev.off()




-SECURITY/CONFIDENTIALITY WARNING-  

This message and any attachments are intended solely for the individual or 
entity to which they are addressed. This communication may contain information 
that is privileged, confidential, or exempt from disclosure under applicable 
law (e.g., personal health information, research data, financial information). 
Because this e-mail has been sent without encryption, individuals other than 
the intended recipient may be able to view the information, forward it to 
others or tamper with the information without the knowledge or consent of the 
sender. If you are not the intended recipient, or the employee or person 
responsible for delivering the message to the intended recipient, any 
dissemination, distribution or copying of the communication is strictly 
prohibited. If you received the communication in error, please notify the 
sender immediately by replying to this message and deleting the message and any 
accompanying files from your system. If, due to the security risks, you do not 
wish to receive further communications via e-mail, please reply to this message 
and inform the sender that you do not wish to receive further e-mail from the 
sender. (LCP301)

__
R-help@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.


Re: [R] heatmap.2, adding a legend at bottom

2018-10-04 Thread David L Carlson
It will take a bit of trial and error. Use this example as a guide. You will 
probably have to set the y coordinate to a negative value and include xpd=TRUE:

> data(mtcars)
> x  <- as.matrix(mtcars)
> heatmap.2(x)
> legend(.5, -.1, "Legend", xpd=TRUE)


David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77843-4352

-Original Message-
From: R-help  On Behalf Of Ding, Yuan Chun
Sent: Thursday, October 4, 2018 1:19 PM
To: r-help@r-project.org
Subject: Re: [R] heatmap.2, adding a legend at bottom


Hi All,

I generated the attached heatmap using the following  R code and attached 
testfile.

I tried to move the legend to the bottom, Can anyone help me?  I have played 
for 3 hours and can not resolve the problem.

I realized that in the last email, I forgot to include the "Group" variable for 
legend. I added to the R code below.

Thank  you,

Ding



png("heatmaps_test2.png",   # create PNG for the heat map
width = 5*300,# 5 x 300 pixels
height = 5*300,
res = 300,# 300 pixels per inch
pointsize = 8  # smaller font size
)

# lmat = rbind(c(0,0,4),c(3,1,2),c(0,0,5))
# #1.  RowSideColors;2.Heatmap;3.Row tree;4.Column tree;5.Color key
# lwid = c(0.8,0.15,7) # lwid controls the column width # lhei = c(0.1,5.5,1) 
#lhei controls the row height


my_palette2 <- colorRampPalette(c("blue", "cyan4", "red"))(n = 299) col_breaks 
= c(seq(-1.5,-1.1,length=100), # for bllue
   seq(-1.099,1.099,length=100),  # for green
   seq(1.1,1.5,length=100)) # for red cols <- c("red", "black", 
"blue") heatmap.2(as.matrix(testfile), key=T,
  #lmat=lmat, lwid=lwid, lhei=lhei,
  symkey=FALSE,#keysize=1, key.par =list(cex=0.25),
  key.xlab="Heatmap color key",
  key.title =" ",
  RowSideColors= cols[as.numeric(as.factor(allinfo.blood$Group))],
  density.info="none",  # turns off density plot inside color legend
  trace="none", # turns off trace lines inside the heat map
  col=my_palette2, # use color palette defined earlier
  breaks=col_breaks,
  cexRow=1.4,
  labCol=" ", # default to colnames(x)
  #labRow=" ",
  #margins =c(12,9),
  #Colv="NA", # only draw a row dendrogram
  hclust=function(x) hclust(x,method="complete"),
  distfun=function(x) as.dist((1-cor(t(x)))/2)
  ) # using pearson correlation as distance

Group <-c("Blood: Vector", "Blood: Vector", "Blood: E2", "Blood: E2",
"Blood: E2+BP3",  "Blood: E2+BP3",  "Blood: Vector",  "Blood: Vector",
"Blood: E2", "Blood: E2", "Blood: E2+BP3",  "Blood: E2+BP3")

 groups = levels(as.factor(Group))
legend(0.2,0.1, groups, col=cols, pch=15, ncol = 3, cex=1)
dev.off()




-SECURITY/CONFIDENTIALITY WARNING-  

This message and any attachments are intended solely for the individual or 
entity to which they are addressed. This communication may contain information 
that is privileged, confidential, or exempt from disclosure under applicable 
law (e.g., personal health information, research data, financial information). 
Because this e-mail has been sent without encryption, individuals other than 
the intended recipient may be able to view the information, forward it to 
others or tamper with the information without the knowledge or consent of the 
sender. If you are not the intended recipient, or the employee or person 
responsible for delivering the message to the intended recipient, any 
dissemination, distribution or copying of the communication is strictly 
prohibited. If you received the communication in error, please notify the 
sender immediately by replying to this message and deleting the message and any 
accompanying files from your system. If, due to the security risks, you do not 
wish to receive further communications via e-mail, please reply to this message 
and inform the sender that you do not wish to receive further e-mail from the 
sender. (LCP301)

__
R-help@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.


Re: [R] heatmap.2, adding a legend at bottom

2018-10-04 Thread Ding, Yuan Chun

Hi All,

I generated the attached heatmap using the following  R code and attached 
testfile.

I tried to move the legend to the bottom, Can anyone help me?  I have played 
for 3 hours and can not resolve the problem.

I realized that in the last email, I forgot to include the "Group" variable for 
legend. I added to the R code below.

Thank  you,

Ding



png("heatmaps_test2.png",   # create PNG for the heat map
width = 5*300,# 5 x 300 pixels
height = 5*300,
res = 300,# 300 pixels per inch
pointsize = 8  # smaller font size
)

# lmat = rbind(c(0,0,4),c(3,1,2),c(0,0,5))
# #1.  RowSideColors;2.Heatmap;3.Row tree;4.Column tree;5.Color key
# lwid = c(0.8,0.15,7) # lwid controls the column width # lhei = c(0.1,5.5,1) 
#lhei controls the row height


my_palette2 <- colorRampPalette(c("blue", "cyan4", "red"))(n = 299) col_breaks 
= c(seq(-1.5,-1.1,length=100), # for bllue
   seq(-1.099,1.099,length=100),  # for green
   seq(1.1,1.5,length=100)) # for red cols <- c("red", "black", 
"blue") heatmap.2(as.matrix(testfile), key=T,
  #lmat=lmat, lwid=lwid, lhei=lhei,
  symkey=FALSE,#keysize=1, key.par =list(cex=0.25),
  key.xlab="Heatmap color key",
  key.title =" ",
  RowSideColors= cols[as.numeric(as.factor(allinfo.blood$Group))],
  density.info="none",  # turns off density plot inside color legend
  trace="none", # turns off trace lines inside the heat map
  col=my_palette2, # use color palette defined earlier
  breaks=col_breaks,
  cexRow=1.4,
  labCol=" ", # default to colnames(x)
  #labRow=" ",
  #margins =c(12,9),
  #Colv="NA", # only draw a row dendrogram
  hclust=function(x) hclust(x,method="complete"),
  distfun=function(x) as.dist((1-cor(t(x)))/2)
  ) # using pearson correlation as distance

Group <-c("Blood: Vector", "Blood: Vector", "Blood: E2", "Blood: E2",
"Blood: E2+BP3",  "Blood: E2+BP3",  "Blood: Vector",  "Blood: Vector",
"Blood: E2", "Blood: E2", "Blood: E2+BP3",  "Blood: E2+BP3")

 groups = levels(as.factor(Group))
legend(0.2,0.1, groups, col=cols, pch=15, ncol = 3, cex=1)
dev.off()




-SECURITY/CONFIDENTIALITY WARNING-

This message and any attachments are intended solely for the individual or 
entity to which they are addressed. This communication may contain information 
that is privileged, confidential, or exempt from disclosure under applicable 
law (e.g., personal health information, research data, financial information). 
Because this e-mail has been sent without encryption, individuals other than 
the intended recipient may be able to view the information, forward it to 
others or tamper with the information without the knowledge or consent of the 
sender. If you are not the intended recipient, or the employee or person 
responsible for delivering the message to the intended recipient, any 
dissemination, distribution or copying of the communication is strictly 
prohibited. If you received the communication in error, please notify the 
sender immediately by replying to this message and deleting the message and any 
accompanying files from your system. If, due to the security risks, you do not 
wish to receive further communications via e-mail, please reply to this message 
and inform the sender that you do not wish to receive further e-mail from the 
sender. (LCP301)

__
R-help@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.


Re: [R] Heatmap help

2017-03-05 Thread Patricia J. Hawkins
Hi, you have a couple of things going on here.  You can reorder your
matrix by creating an index like this:

> A_index=c(grep(".A", colnames(A)), grep(".B", colnames(A)))

and do this:

> heatmap.2(A[,A_index], dendrogram="col", Rowv = colnames(A)[A_index], 
> tracecol =
  NA,col=bluered(64), sub = "",
  distfun = function(y) dist(y, method = "euclidean"), hclustfun =
  function(y) hclust(y, method = "median"),
  scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
 "Samples", margins = c(9,9), keysize = 1,
  main='Test')

But you're constructing your dendrogram on the columns, so your columns
get reordered by mean weight.  (Also, you've misunderstood Rowv and Colv.)

However, if you force your columns to not reorder by setting
"Colv=FALSE", AND tell it to construct the dendrogram on the columns,
you get a warning, because that's contradictory:

> heatmap.2(A[,A_index], dendrogram="col", Colv = FALSE, tracecol = 
> NA,col=bluered(64), sub = "",
  distfun = function(y) dist(y, method = "euclidean"),  
  hclustfun = function(y) hclust(y, method = "median"),
  scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
  "Samples", margins = c(9,9), keysize = 1, main='Test')
Warning message:
In heatmap.2(A[, A_index], dendrogram = "col", Colv = FALSE, tracecol = NA,  :
  Discrepancy: Colv is FALSE, while dendrogram is `column'. Omitting column 
dendogram.

Maybe you really meant to build your dendrogram on the rows, like this:

heatmap.2(A[,A_index], dendrogram="row", Colv = FALSE, tracecol = 
NA,col=bluered(64), sub = "",
  distfun = function(y) dist(y, method = "euclidean"),  
  hclustfun = function(y) hclust(y, method = "median"),
  scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
  "Samples", margins = c(9,9), keysize = 1, main='Test')

If that's not it, I suggest playing around with the examples in
?heatmap.2 since the documentation is kind of opaque, but the examples
are pretty good.

> "ALN" == André Luis Neves  writes:

ALN> Dear all,

ALN> I was wondering if you could help me to construct a heat map, in which the
ALN> columns are sorted by sample type (A first and then B).
ALN> My reproducible example below runs, but the columns of the heatmap are not
ALN> organized in the way I would like because it has first sampleA, SampleB,
ALN> sampleA, and then sampleB.


ALN> A = matrix(rnorm(20), 5,8)
ALN> A
ALN> colnames(A) <- c ("Sample1.A", "Sample2.B", "Sample3.A", "Sample4.B",
ALN> "Sample5.A", "Sample6.B", "Sample7.A", "Sample8.B")
ALN> A
ALN> rownames(A) <- c ("protein1","protein2", "protein3", "protein4","protein5")
ALN> A

ALN> heatmap.2(A, dendrogram="col", Rowv = colnames(A), tracecol =
ALN> NA,col=bluered(64), sub = "",
ALN>   distfun = function(y) dist(y, method = "euclidean"), hclustfun =
ALN> function(y) hclust(y, method = "median"),
ALN>   scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
ALN> "Samples", margins = c(9,9), keysize = 1,
ALN>   main='Test')



ALN> ​Thanks.

ALN> -- 
ALN> Andre

ALN>[[alternative HTML version deleted]]

ALN> __
ALN> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
ALN> https://stat.ethz.ch/mailman/listinfo/r-help
ALN> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
ALN> and provide commented, minimal, self-contained, reproducible code.



-- 
Patricia J. Hawkins

__
R-help@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.

Re: [R] Heatmap help

2017-03-04 Thread André Luis Neves
Thanks, Patricia! I will do it by the rows, and your explanations were
great and easy to follow!

Thank you very much for your help and time.

Andre

On Mar 4, 2017 4:18 PM, "Patricia J. Hawkins"  wrote:

Hi, you have a couple of things going on here.  You can reorder your
matrix by creating an index like this:

> A_index=c(grep(".A", colnames(A)), grep(".B", colnames(A)))

and do this:

> heatmap.2(A[,A_index], dendrogram="col", Rowv = colnames(A)[A_index],
tracecol =
  NA,col=bluered(64), sub = "",
  distfun = function(y) dist(y, method = "euclidean"), hclustfun =
  function(y) hclust(y, method = "median"),
  scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
 "Samples", margins = c(9,9), keysize = 1,
  main='Test')

But you're constructing your dendrogram on the columns, so your columns
get reordered by mean weight.  (Also, you've misunderstood Rowv and Colv.)

However, if you force your columns to not reorder by setting
"Colv=FALSE", AND tell it to construct the dendrogram on the columns,
you get a warning, because that's contradictory:

> heatmap.2(A[,A_index], dendrogram="col", Colv = FALSE, tracecol =
NA,col=bluered(64), sub = "",
  distfun = function(y) dist(y, method = "euclidean"),
  hclustfun = function(y) hclust(y, method = "median"),
  scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
  "Samples", margins = c(9,9), keysize = 1, main='Test')
Warning message:
In heatmap.2(A[, A_index], dendrogram = "col", Colv = FALSE, tracecol =
NA,  :
  Discrepancy: Colv is FALSE, while dendrogram is `column'. Omitting column
dendogram.

Maybe you really meant to build your dendrogram on the rows, like this:

heatmap.2(A[,A_index], dendrogram="row", Colv = FALSE, tracecol =
NA,col=bluered(64), sub = "",
  distfun = function(y) dist(y, method = "euclidean"),
  hclustfun = function(y) hclust(y, method = "median"),
  scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes", xlab =
  "Samples", margins = c(9,9), keysize = 1, main='Test')

If that's not it, I suggest playing around with the examples in
?heatmap.2 since the documentation is kind of opaque, but the examples
are pretty good.

> "ALN" == André Luis Neves  writes:

ALN> Dear all,

ALN> I was wondering if you could help me to construct a heat map, in which
the
ALN> columns are sorted by sample type (A first and then B).
ALN> My reproducible example below runs, but the columns of the heatmap are
not
ALN> organized in the way I would like because it has first sampleA,
SampleB,
ALN> sampleA, and then sampleB.


ALN> A = matrix(rnorm(20), 5,8)
ALN> A
ALN> colnames(A) <- c ("Sample1.A", "Sample2.B", "Sample3.A", "Sample4.B",
ALN> "Sample5.A", "Sample6.B", "Sample7.A", "Sample8.B")
ALN> A
ALN> rownames(A) <- c ("protein1","protein2", "protein3",
"protein4","protein5")
ALN> A

ALN> heatmap.2(A, dendrogram="col", Rowv = colnames(A), tracecol =
ALN> NA,col=bluered(64), sub = "",
ALN>   distfun = function(y) dist(y, method = "euclidean"),
hclustfun =
ALN> function(y) hclust(y, method = "median"),
ALN>   scale = "row",cexCol = 1, cexRow = 0.9, ylab = "Enzymes",
xlab =
ALN> "Samples", margins = c(9,9), keysize = 1,
ALN>   main='Test')



ALN> ​Thanks.

ALN> --
ALN> Andre

ALN>[[alternative HTML version deleted]]

ALN> __
ALN> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
ALN> https://stat.ethz.ch/mailman/listinfo/r-help
ALN> PLEASE do read the posting guide http://www.R-project.org/
posting-guide.html
ALN> and provide commented, minimal, self-contained, reproducible code.



--
Patricia J. Hawkins

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Heatmap Colnames

2016-04-05 Thread Jim Lemon
Hi Nils,
I don't have the GMD library, but this looks like some axis labels are
being ignored to avoid overlapping. If heatmap.3 uses base graphics
you can probably get your labels by passing empty strings to heatmap.3
and then displaying the axis with staxlab (plotrix).

Jim


On Wed, Apr 6, 2016 at 9:58 AM, Nils Korte <20406...@student.gla.ac.uk> wrote:
> Hello,
> please see below my code for a heatmap. Unfortunately my column names do not 
> completely appear. Can you please send me the appropriate code to visualise 
> them?
> Many Thanks!
> Nils
>
>
> library(GMD)
>
> dat<-data.frame(EntryA=as.numeric(c(4.24,3,1.66,1.28,1.2,-1.32,-1.88)), 
> EntryB=as.numeric(c(4.16,4.82,-1.82,-3.02,0.99,1.1,-3.31)))
>
> rownames(dat)=c("hsa-miR-200c","hsa-miR-520b","hsa-miR-199a-3p","mmu-miR-124a","hsa-miR-302a","hsa-miR-454","mmu-miR-137")
>
> colnames(dat)=c("24", "72")
>
> heatmap.3(dat, srtCol=70)
>
> ndat<-as.matrix(dat)
>
> heatmap.3(ndat, Rowv=FALSE, Colv=FALSE)
>
> __
> R-help@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.

__
R-help@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.


Re: [R] Heatmap.2 error

2015-06-19 Thread Adams, Jean
Pijush,

The error is a result of you having repeated color values.  The warnings
can be addressed by changing the arguments that you use.  Attachments are
removed from posts to R Help, so I used different data to show you an
example.

Jean


library(gplots)

data(mtcars)
x  - as.matrix(mtcars[1:6, 3:4])
x[1:3, ] - -x[1:3, ]

colors1 - c(seq(-170, 0, 10), seq(0, 370, 10))
my_palette1 - colorRampPalette(c(green, black,
red))(n=length(colors1)-1)
heatmap.2(x, col=my_palette1, breaks=colors1, symkey=FALSE, density.info
=none,
  trace=none, dendrogram=none)

colors2 - unique(colors1)
my_palette2 - colorRampPalette(c(green, black,
red))(n=length(colors2)-1)
heatmap.2(x, col=my_palette2, breaks=colors2, symkey=FALSE, density.info
=none,
  trace=none, dendrogram=none)


On Fri, Jun 19, 2015 at 9:02 AM, Pijush Das topij...@gmail.com wrote:

 Dear Sir,

 Please help me solving the error occurring during the execution of the code
 given below.


 library(openxlsx)
 library(gplots)
 library(RColorBrewer)

 rix - read.xlsx(file.choose(), sheet = 1, colNames = TRUE,rowNames = TRUE)
 rawdata - data.matrix(rix)


 colors =
 c(seq(-2,-0.5,length=100),seq(-0.5,1,length=100),seq(1,2,length=100))
 my_palette - colorRampPalette(c(green, black, red))(n = 299)

  heatmap.2(rawdata, col=my_palette, scale=row,  key=TRUE, symkey=FALSE,
 density.info=none, trace=none, cexRow=0.5, Rowv = FALSE, Colv=FALSE,
 breaks=colors)


 Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/4)) :  invalid
 (to - from)/by in seq(.)
 In addition: Warning messages:
 1: In heatmap.2(rawdata, col = my_palette, scale = row, key = TRUE,  :
   Using scale=row or scale=column when breaks arespecified can produce
 unpredictable results.Please consider using only one or the other.
 2: In heatmap.2(rawdata, col = my_palette, scale = row, key = TRUE,  :
   Discrepancy: Rowv is FALSE, while dendrogram is `none'. Omitting row
 dendogram.
 

 Please find the data set attached with the email.


 Thanking you.

 Regards
 Pijush
 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap

2015-05-22 Thread David Winsemius

On May 22, 2015, at 10:32 AM, Carlos Javier Rincon Rodriguez wrote:

 Hi. Good morning.
 
 I am trying to load a shapefile to do a heatmap of Colombia. I using all
 this package:
 
 library(ctv)
 
 library(spatial)
 
 library(ggplot2)
 
 library(sp)
 
 library(rgdal)
 
 library(rgeos)
 
 library(maptools)
 
 library(ggmap)
 
 
 and a using this two commands to load the file:
 
 
 depto-readShapePoly(depto.shp)

Was going to suggest following up on the SIG-geo mailing list since the 
shape-shifters don't all hang out in these parts, but I see that you 
crossposted. (That's not considered good form on R mailing lists.)

 
 depto - readOGR(dsn = ., depto)
 
 
 but the result is:
 
 
 depto-readShapePoly(depto.shp)
 
 Error in getinfo.shape(filen) : Error opening SHP file
 
 
 depto - readOGR(dsn = ., depto)
 
 Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding,
 use_iconv = use_iconv,  : Cannot open file
 
 
 Also I am working in a MAC computer and when I open R, I have this warning
 message:
 
 
WARNING: You're using a non-UTF8 locale, therefore only ASCII
 characters will work.
 
Please read R for Mac OS X FAQ (see Help) section 9 and adjust your
 system preferences accordingly.
 
 
 I looking the R for Mac document but there is not section 9.!!!

This FAQ:

http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

(I see 10 numbered major headings, although admittedly the 9th is the 
acknowledgements section. I'm wondering if it were the 7th section that was 
meant, since it has information about setting the locale.)

-- 
David.
 
 
 Thanks for any help.
 
 
 
 Carlos.
 
 
 
 2015-05-05 18:01 GMT-05:00 Carlos Javier Rincon Rodriguez 
 cjrinc...@unal.edu.co:
 
 Hi.
 
 This is my problem. I try to load a shapefile to do a heatmap of Colombia.
 I using all this package:
 
 library(ctv)
 
 library(spatial)
 
 library(ggplot2)
 
 library(sp)
 
 library(rgdal)
 
 library(rgeos)
 
 library(maptools)
 
 library(ggmap)
 
 
 and a using this two commands to load the file:
 
 
 depto-readShapePoly(depto.shp)
 
 depto - readOGR(dsn = ., depto)
 
 
 but the result is:
 
 
 depto-readShapePoly(depto.shp)
 
 Error in getinfo.shape(filen) : Error opening SHP file
 
 
 depto - readOGR(dsn = ., depto)
 
 Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv
 = use_iconv,  :
 
  Cannot open file
 
 I attach the shapefile that i using.
 
 also i am working in mac computer i don know if that could be the reason.
 
 if somebody knows thanks.
 
 
 
 2015-04-28 4:18 GMT-05:00 John Sorkin jsor...@grecc.umaryland.edu:
 
 Look at the heatmap function
 
 John David Sorkin M.D., Ph.D.
 Professor of Medicine
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology and
 Geriatric Medicine
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)
 
 
 On Apr 28, 2015, at 3:41 AM, John Wasige johnwas...@gmail.com wrote:
 
 Dear all,
 
 I need to make a heapmap of SPI results for a monthly timeseies of 30
 years. Does anybody know to do it?
 
 Thanks for your help
 
 John
 
   [[alternative HTML version deleted]]
 
 __
 


David Winsemius
Alameda, CA, USA

__
R-help@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.


Re: [R] Heatmap

2015-05-22 Thread Jim Lemon
Hi Carlos,
The error from:

readShapePoly(depto.shp)

may well be that the function cannot find the file. Assuming that
there is a file depto.shp, is it in the working directory of R when
you issue this command? Find out by:

getwd()

I suppose that macintosh computers try to hide the actual location of
files, so you may have to hunt around to find where the file resides
and whether you will have to add a path to your call. The second error
probably stems from the first, as if the file hasn't been read, the
information in it cannot be extracted.

Jim


On Sat, May 23, 2015 at 7:07 AM, David Winsemius dwinsem...@comcast.net wrote:

 On May 22, 2015, at 10:32 AM, Carlos Javier Rincon Rodriguez wrote:

 Hi. Good morning.

 I am trying to load a shapefile to do a heatmap of Colombia. I using all
 this package:

 library(ctv)

 library(spatial)

 library(ggplot2)

 library(sp)

 library(rgdal)

 library(rgeos)

 library(maptools)

 library(ggmap)


 and a using this two commands to load the file:


 depto-readShapePoly(depto.shp)

 Was going to suggest following up on the SIG-geo mailing list since the 
 shape-shifters don't all hang out in these parts, but I see that you 
 crossposted. (That's not considered good form on R mailing lists.)


 depto - readOGR(dsn = ., depto)


 but the result is:


 depto-readShapePoly(depto.shp)

 Error in getinfo.shape(filen) : Error opening SHP file


 depto - readOGR(dsn = ., depto)

 Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding,
 use_iconv = use_iconv,  : Cannot open file


 Also I am working in a MAC computer and when I open R, I have this warning
 message:


WARNING: You're using a non-UTF8 locale, therefore only ASCII
 characters will work.

Please read R for Mac OS X FAQ (see Help) section 9 and adjust your
 system preferences accordingly.


 I looking the R for Mac document but there is not section 9.!!!

 This FAQ:

 http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

 (I see 10 numbered major headings, although admittedly the 9th is the 
 acknowledgements section. I'm wondering if it were the 7th section that was 
 meant, since it has information about setting the locale.)

 --
 David.


 Thanks for any help.



 Carlos.



 2015-05-05 18:01 GMT-05:00 Carlos Javier Rincon Rodriguez 
 cjrinc...@unal.edu.co:

 Hi.

 This is my problem. I try to load a shapefile to do a heatmap of Colombia.
 I using all this package:

 library(ctv)

 library(spatial)

 library(ggplot2)

 library(sp)

 library(rgdal)

 library(rgeos)

 library(maptools)

 library(ggmap)


 and a using this two commands to load the file:


 depto-readShapePoly(depto.shp)

 depto - readOGR(dsn = ., depto)


 but the result is:


 depto-readShapePoly(depto.shp)

 Error in getinfo.shape(filen) : Error opening SHP file


 depto - readOGR(dsn = ., depto)

 Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv
 = use_iconv,  :

  Cannot open file

 I attach the shapefile that i using.

 also i am working in mac computer i don know if that could be the reason.

 if somebody knows thanks.



 2015-04-28 4:18 GMT-05:00 John Sorkin jsor...@grecc.umaryland.edu:

 Look at the heatmap function

 John David Sorkin M.D., Ph.D.
 Professor of Medicine
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology and
 Geriatric Medicine
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)


 On Apr 28, 2015, at 3:41 AM, John Wasige johnwas...@gmail.com wrote:

 Dear all,

 I need to make a heapmap of SPI results for a monthly timeseies of 30
 years. Does anybody know to do it?

 Thanks for your help

 John

   [[alternative HTML version deleted]]

 __



 David Winsemius
 Alameda, CA, USA

 __
 R-help@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.

__
R-help@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.


Re: [R] Heatmap

2015-05-22 Thread Carlos Javier Rincon Rodriguez
Hi. Good morning.

I am trying to load a shapefile to do a heatmap of Colombia. I using all
this package:

library(ctv)

library(spatial)

library(ggplot2)

library(sp)

library(rgdal)

library(rgeos)

library(maptools)

library(ggmap)


and a using this two commands to load the file:


depto-readShapePoly(depto.shp)

depto - readOGR(dsn = ., depto)


but the result is:


 depto-readShapePoly(depto.shp)

 Error in getinfo.shape(filen) : Error opening SHP file


 depto - readOGR(dsn = ., depto)

 Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding,
use_iconv = use_iconv,  : Cannot open file


Also I am working in a MAC computer and when I open R, I have this warning
message:


WARNING: You're using a non-UTF8 locale, therefore only ASCII
characters will work.

Please read R for Mac OS X FAQ (see Help) section 9 and adjust your
system preferences accordingly.


I looking the R for Mac document but there is not section 9.!!!


Thanks for any help.



Carlos.



2015-05-05 18:01 GMT-05:00 Carlos Javier Rincon Rodriguez 
cjrinc...@unal.edu.co:

 Hi.

 This is my problem. I try to load a shapefile to do a heatmap of Colombia.
 I using all this package:

 library(ctv)

 library(spatial)

 library(ggplot2)

 library(sp)

 library(rgdal)

 library(rgeos)

 library(maptools)

 library(ggmap)


 and a using this two commands to load the file:


 depto-readShapePoly(depto.shp)

 depto - readOGR(dsn = ., depto)


 but the result is:


 depto-readShapePoly(depto.shp)

 Error in getinfo.shape(filen) : Error opening SHP file


 depto - readOGR(dsn = ., depto)

 Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv
 = use_iconv,  :

   Cannot open file

 I attach the shapefile that i using.

 also i am working in mac computer i don know if that could be the reason.

 if somebody knows thanks.



 2015-04-28 4:18 GMT-05:00 John Sorkin jsor...@grecc.umaryland.edu:

 Look at the heatmap function

  John David Sorkin M.D., Ph.D.
  Professor of Medicine
  Chief, Biostatistics and Informatics
  University of Maryland School of Medicine Division of Gerontology and
 Geriatric Medicine
  Baltimore VA Medical Center
  10 North Greene Street
  GRECC (BT/18/GR)
  Baltimore, MD 21201-1524
  (Phone) 410-605-7119
  (Fax) 410-605-7913 (Please call phone number above prior to faxing)


  On Apr 28, 2015, at 3:41 AM, John Wasige johnwas...@gmail.com wrote:
 
  Dear all,
 
  I need to make a heapmap of SPI results for a monthly timeseies of 30
  years. Does anybody know to do it?
 
  Thanks for your help
 
  John
 
 [[alternative HTML version deleted]]
 
  __
  R-help@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.

 Confidentiality Statement:
 This email message, including any attachments, is for the sole use of the
 intended recipient(s) and may contain confidential and privileged
 information. Any unauthorized use, disclosure or distribution is
 prohibited. If you are not the intended recipient, please contact the
 sender by reply email and destroy all copies of the original message.
 __
 R-help@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.




[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap

2015-04-28 Thread John Sorkin
Look at the heatmap function 

 John David Sorkin M.D., Ph.D.
 Professor of Medicine
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology and 
 Geriatric Medicine
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)


 On Apr 28, 2015, at 3:41 AM, John Wasige johnwas...@gmail.com wrote:
 
 Dear all,
 
 I need to make a heapmap of SPI results for a monthly timeseies of 30
 years. Does anybody know to do it?
 
 Thanks for your help
 
 John
 
[[alternative HTML version deleted]]
 
 __
 R-help@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.

Confidentiality Statement:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized use, disclosure or distribution is prohibited. If you are not 
the intended recipient, please contact the sender by reply email and destroy 
all copies of the original message. 
__
R-help@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.


Re: [R] Heatmap - strange horizontal lines

2014-10-24 Thread Jeff Newmiller
I don't use these functions often enough to know their idiosyncrasies, but they 
appear to treat zero like a NA, and your second file has lots of zeros. I 
suspect this is due to the default way the continuous act data are 'cut 
excluding the left side of the bins. If you read the help files you may find a 
way to change this or you could cut it to a factor yourself and give the factor 
to be plotted instead of the continuous variable.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On October 23, 2014 11:45:54 AM PDT, zuzana zajkova zuzu...@gmail.com wrote:
Dear list,

I would like to make heatmaps from my data. Acctualy, I have already
done
it, but the issue it that is doesn't work well for all files.

All files have the same structure, after importing them I do few
calculations using the same script, to obtain variables for plotting.

You can find the files here, the pb2166 is the one which works fine and
I
get normal (expected) heatmap plot, the pb2214 it the other type, for
which
I obtain strange horizontal lines...

https://www.dropbox.com/s/rz2ywnloepvr3d8/pb2166.csv?dl=0
https://www.dropbox.com/s/42taaybtbortv0p/pb2214.csv?dl=0

The structure of data is this (the same, from my point of view...):

str(pb2166)
'data.frame':  55119 obs. of  3 variables:
 $ dtime: num  17.9 18.1 18.3 18.4 18.6 ...
 $ act  : int  9 1 0 0 0 0 0 0 0 0 ...
 $ jul  : num  13573 13573 13573 13573 13573 ...

str(pb2214)
'data.frame':  44707 obs. of  3 variables:
 $ dtime: num  17.9 18.1 18.2 18.4 18.6 ...
 $ act  : int  9 1 0 0 0 0 0 0 0 0 ...
 $ jul  : num  13573 13573 13573 13573 13573 ...


To  create a heatmap I tried ggplot/qlot and levelplot aswell, the
results
are the same... for pb2166 works ok, for pb2214 doesn't...

qplot(jul, dtime, data=pb2166, geom=tile, fill=act) +
scale_fill_gradient(low=gold, high=green4)
levelplot(act ~ jul * dtime, pb2166 )

qplot(jul, dtime, data=pb2214, geom=tile, fill=act) +
scale_fill_gradient(low=gold, high=green4)
levelplot(act ~ jul * dtime, pb2214 )

I would be very thankful if somebody could take a look on the data and
find
something what I am missing.

Kind regards,

Zuzana

   [[alternative HTML version deleted]]

__
R-help@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.

__
R-help@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.


Re: [R] Heatmap, and heatmap.2 gave different figures for the same dataset

2013-12-12 Thread Kevin Wright
Read the help page for both and pay particular attention to the scale
argument.

Kevin Wright



On Thu, Dec 12, 2013 at 9:45 AM, capricy gao capri...@yahoo.com wrote:

 I have a huge dataset(15k X 18) and tried to use the heatmap in R to
 examine the patterns. However, I found that heatmap and heatmap.2 gave me
 completely different outputs.

 Here are the codes:

 

  dim(as.matrix(data.dcpm))
 [1] 1546218
 
  heatmap(as.matrix(data.dcpm), col=topo.colors(100))
  heatmap.2(as.matrix(data.dcpm), col=topo.colors(100), key=TRUE,
 density.inf=none,trace=none, scale=none)
 ---

 The outputs are attached here.

 Could anyone help me figure out why?

 Thanks a lot:)

 __
 R-help@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.




-- 
Kevin Wright

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap, and heatmap.2 gave different figures for the same dataset

2013-12-12 Thread capricy gao
Thank you very much for the hints. I fixed the problem.





On Thursday, December 12, 2013 2:08 PM, Kevin Wright kw.s...@gmail.com wrote:
 
Read the help page for both and pay particular attention to the scale 
argument.

Kevin Wright





On Thu, Dec 12, 2013 at 9:45 AM, capricy gao capri...@yahoo.com wrote:

I have a huge dataset(15k X 18) and tried to use the heatmap in R to examine 
the patterns. However, I found that heatmap and heatmap.2 gave me completely 
different outputs.

Here are the codes:



 dim(as.matrix(data.dcpm))
[1] 15462    18

 heatmap(as.matrix(data.dcpm), col=topo.colors(100))
 heatmap.2(as.matrix(data.dcpm), col=topo.colors(100), key=TRUE, 
 density.inf=none,trace=none, scale=none)
---

The outputs are attached here.

Could anyone help me figure out why?

Thanks a lot:)

__
R-help@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.




-- 
Kevin Wright
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap Help

2013-12-11 Thread Sarah Goslee
You have some randomly doubled quotation marks and parentheses.

A text editor with syntax highlighting is wonderful for catching that
sort of problem.

Beyond that, see:

?heatmap

A very urgent request suggests homework to me, which this list doesn't do.

Though sometimes someone will offer a hint or two...

Sarah

On Wed, Dec 11, 2013 at 2:31 PM, Gaurav Pandey
gaurav.pandey...@gmail.com wrote:
 Hello,
 I want a help, i have to make heat map.And i am using the following command
 In R for generating a matrix, but its returning an error,and i am not able
 to figure it out.
 Can you please tell me what is wrong?
 And please also suggest me how to generate a heat map.
 Its very urgent.

 Thanks a lot.

 mat -
 matrix(c(100,49.3,45.71,54.29,97.22,68.57,49.3,100,22.54,26.76,50.7,33.8,45.71,22.54,100,84.21,44.44,66.67,54.29,26.76,84.21,100,52.78,79.17,97.22,50.7,44.44,52.78,100,66.67,68.57,33.8,66.67,79.17,66.67,100),
 nrow = 6, ncol = 6, byrow = TRUE,dimnames =
 list(c(A_1HJO,B_2L1W,C_1MHS,D_1HQY,E_1XU4,F_1JNB),c((A_1HJO,B_2L1W,C_1MHS,D_1HQY,E_1XU4,F_1JNB

 Error: unexpected symbol in
 49.3,45.71,54.29,97.22,68.57,49.3,100,22.54,26.76,50.7,33.8,45.71,22.54,100,84.21,44.44,66.67,54.29,26.76,84.21,100,52.78,79.17,97.22,50.7,44.44,52.78,100,66.67,68.57,33.8,66.67,79.17,66.67,10

 Gaurav Pandey
 PhD Scholar
 Department of Biotechnology,
 Indian Institute of Technology Guwahati.



-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@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.


Re: [R] heatmap scale parameter question

2013-08-01 Thread Witold E Wolski
I do not want to use the b word, but can anyone who also subscribes to
the r-developer list forward my observation regarding heatmap? I am
pretty confident that the behaviour of heatmap in R 3.0.1 is not that
one intended.




On 31 July 2013 14:03, Witold E Wolski wewol...@gmail.com wrote:
 Would anyone of the more experienced r-users explain to me the
 behaviour of the scale parameter in the heatmap function.

 different options for scale (R 3.0.1) do change only the colors but do
 not affect the dendrograms. Please see for yourself executing the
 following code:

 d - matrix(rnorm(100),nrow=20)
 stats::heatmap(d)
 X11()
 heatmap(d,scale=column)
 X11()
 heatmap(d,scale=row)
 X11()
 heatmap(d,scale=none)

 In all four above cases the dendrograms look exactly the same
 However, scaling clearly affects clustering. see:

 d - scale(d)
 heatmap(d,scale=none)


 best regards

 R version 3.0.1 (2013-05-16) -- Good Sport
 ciao

 --
 Witold Eryk Wolski


 --
 Witold Eryk Wolski



-- 
Witold Eryk Wolski

__
R-help@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.


Re: [R] heatmap scale parameter question

2013-07-31 Thread David Carlson
In your example all of the values are drawn from the same
distribution so there will not be substantial differences (row
means/variances and column means/variances will be
approximately the same). 

set.seed(42)
d - matrix(rnorm(100),nrow=20)
# Start with your example and modify the row/col means
rows - sample.int(15:25, 20, replace=TRUE)
cols - sample.int(5:15, 5, replace=TRUE)
d2 - sweep(d, 2, cols, +)
d2 - sweep(d2, 1, rows, +)
heatmap(d2, scale=none)
heatmap(d2, scale=row)
heatmap(d2, scale=col)

-
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77840-4352




-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Witold E
Wolski
Sent: Wednesday, July 31, 2013 7:04 AM
To: r-help@r-project.org
Subject: [R] heatmap scale parameter question

Would anyone of the more experienced r-users explain to me the
behaviour of the scale parameter in the heatmap function.

different options for scale (R 3.0.1) do change only the
colors but do
not affect the dendrograms. Please see for yourself executing
the
following code:

d - matrix(rnorm(100),nrow=20)
stats::heatmap(d)
X11()
heatmap(d,scale=column)
X11()
heatmap(d,scale=row)
X11()
heatmap(d,scale=none)

In all four above cases the dendrograms look exactly the same
However, scaling clearly affects clustering. see:

d - scale(d)
heatmap(d,scale=none)


best regards

R version 3.0.1 (2013-05-16) -- Good Sport
ciao

--
Witold Eryk Wolski


-- 
Witold Eryk Wolski

__
R-help@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.

__
R-help@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.


Re: [R] Heatmap with error message: `x' must be a numeric matrix

2013-06-26 Thread peter dalgaard

On Jun 25, 2013, at 21:51 , Rui Barradas wrote:

 Hello,
 
 Your data has commas as decimal points, R uses the period. So the data is 
 read in as strings, not numbers. You can change this by using argument 'dec' 
 of read.table:
 
 ?read.table
 read.table(...etc..., dec = ,)
 
 
 Or you can replace the commas with periods:
 

Or use read.delim2(). That is what it is for.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@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.


Re: [R] Heatmap with error message: `x' must be a numeric matrix

2013-06-25 Thread Rui Barradas

Hello,

Your data has commas as decimal points, R uses the period. So the data 
is read in as strings, not numbers. You can change this by using 
argument 'dec' of read.table:


?read.table
read.table(...etc..., dec = ,)


Or you can replace the commas with periods:


data[] - sapply(data, function(x) as.numeric(sub(,, \\., x)))

data1 - as.matrix(data)
heatmap.2(...)  # No errors


Hope this helps,

Rui Barradas

Em 25-06-2013 19:49, Gitte Brinch Andersen escreveu:

Hi

I am trying to do a heatmap, but I can't see what I am doing wrong. I get the 
error message: `x' must be a numeric matrix, but as far as I know I have 
changed my data into a matrix.

The dataset I have in my example of my run is only a small part. I have around 
1000 rows in total. I have checked that none of the rows contains any letters 
etc, and I have removed the rows where some of the samples contain NA. So I 
can't see why the numbers aren't numeric.

I have tried to change the numbers to contain dots instead of commas, but this 
still gives me the same error.

I hope someone can give me a hint to what I am doing wrong!

I am still very new to R, and apologize in advance if this is just some simple 
stupid mistake.

My R run is this:

#Load in data

data-read.table(/Users/gban/Desktop/Probes_for_heatmap_35_meth_diff_both_hypo_and_hypermeth_Geneprobenames.txt,sep=\t,header=TRUE,row.names=1)




# Throw out rows with missing values.

data = na.omit(data)





data

   OS_Tumor1_08_14985_2_3 OS_Tumor2_08_226869_1
CHST3_cg04268405_1   0,9503806050,76433753
DLX5_cg19962750_2 0,93111825   0,753845234
ZIC4_cg12892506_30,860337466   0,696149332
DLX5_cg05597836_40,906981714   0,664148911
ARHGEF7_cg09129334_6  0,88102921   0,726231077
ZIC4_cg02387803_70,770987986   0,568085839
ZIC4_cg05855917_80,880514891   0,681148663
DLX5_cg13286614_90,855132688   0,592368469
ZIC4_cg04556126_10   0,907405655   0,718858033
LOC145845_cg25718467_11  0,893492688   0,793191968
ZIC4_cg08393041_12   0,911133787   0,678042743
SNED1_cg03785076_13  0,8620608830,70294155
C10orf116_cg01004363_14  0,858555164   0,553920222
DLX5_cg20250426_15   0,9031658280,64976206
EPHX3_cg16184495_16  0,927538308   0,519523714
SNED1_cg21304158_17  0,762270611   0,647588457
EN1_cg12418535_190,790529679   0,318880892
RTKN_cg00689340_20   0,941714187   0,675243565
SNED1_cg16937168_21  0,894421593   0,821448724
CD93_cg12873119_220,86949625   0,676389091
RRN3P2_cg00525931_23 0,862670615   0,855822961
GPBAR1_cg18581950_24 0,800216557   0,810012301
SPARCL1_cg15552249_250,815666773   0,837099021
HOXD12_cg23130254_26 0,840109076   0,502896181
ZIC4_cg08889797_27   0,779606392   0,591615859
ESRP2_cg06723863_28  0,6554880670,47819514
ZIC4_cg16790847_29   0,735676228   0,611372155
PFDN5_cg16309127_30  0,753348167   0,630504254
ARHGEF7_cg05776861_310,951737748   0,926613919
TBX15_cg24720355_32  0,906521431   0,364984479
FER1L5_cg01876130_33 0,601084686   0,805388591
HOXD12_cg1804_34 0,865974739   0,543178066
DLX6AS_cg26251506_35 0,804479354   0,538022928
GSTM5_cg05376982_36  0,733426641   0,552089202
ZIC4_cg12976081_37   0,464939006   0,551218578
HOXB4_cg02132714_38  0,798491712   0,718121432
HOXD10_cg17489939_39 0,970868858   0,790134913
C10orf116_cg12261786_40  0,727394677   0,573072856
SPARCL1_cg19466563_41 0,79754226   0,722582785
HOXD12_cg03964958_42 0,778450531   0,679889139
HOXA5_cg09549073_430,4652904   0,377825589
ZIC4_cg00334063_44   0,783052842   0,634682328
TBX15_cg16990168_45  0,893463329   0,235197972

#Load gplot package

library(gplots)


#Make the data 

Re: [R] heatmap.2 problem

2013-01-13 Thread Uwe Ligges



On 12.01.2013 23:40, Peter Davidsen wrote:

Dear List,

I'm trying to generate a simple heatmap that has each row and column
separated by a black line. However, for some reason this only happens
for the first and last color. The middle color in my colorpanel()
command has an addition horizontal and vertical line that I would like
to get rid off. Any suggestions?

#my code below

my.matrix - cbind(func.1 = c(1,2,2,1,1,3,1,2,3,1,1,2,2,3,1), func.2 =
c(2,2,1,1,3,3,1,1,2,2,1,3,3,2,1))

mycol - colorpanel(n=3,green,grey,red)



We get:
Error: could not find function colorpanel

Your code is not reproducible.

Best,
Uwe Ligges




heatmap.2(my.matrix,Rowv=FALSE, Colv=Rowv, col=mycol, trace=both,
tracecol=black, key=FALSE, symm=FALSE, vline=NULL, hline=NULL)


Kind regards,
Peter

__
R-help@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.



__
R-help@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.


Re: [R] heatmap.2 problem

2013-01-13 Thread Peter Davidsen
Sorry, I should have added

library(gplots)

in the beginning of my code

On Sun, Jan 13, 2013 at 5:04 PM, Uwe Ligges
lig...@statistik.tu-dortmund.de wrote:

 mycol - colorpanel(n=3,green,grey,red)




- - -
Peter K Davidsen | MSc, PhD stud. | Centre for Systems Biology | Univ.
of Liverpool | Crown Street | L69 7ZB, UK | cell: +44 (0)7428 950501

__
R-help@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.


Re: [R] heatmap with symbols

2012-11-15 Thread Jean V Adams
Use the col= argument to the heatmap() function to specify the three 
colors you want.  For example:
x - matrix(rnorm(50), ncol=5)
heatmap(x, col=1:3)

Jean



furor furor1...@gmail.com wrote on 11/14/2012 03:31:42 AM:
 
 Hi all,
 
 I've made a heatmap using '-', '=' and '+' as possible values. However, 
the
 heatmap itself shows more than three colors. How to avoid this?
 
 Thanks in advance.
 
 regards

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap Colors

2012-09-29 Thread Achim Zeileis

On Fri, 28 Sep 2012, David Winsemius wrote:



On Sep 28, 2012, at 4:52 PM, David Winsemius wrote:



On Sep 28, 2012, at 3:16 PM, Nick Fankhauser wrote:


Hello R-Users!

I'm using a heatmap to visualize a matrix of values between -1 and 3.
How can I set the colors so that white is zero, below zero is blue of 
increasing intensity towards -1 and above zero is red of increasing intensity 
towards red?

I tried like this (using the marray and gplots packages from bioconductor):
mcol - maPalette(low=blue, mid=white, high=red,k=100)
heatmap.2(my_matrix, col=mcol)

But white does not correspond to zero, because the value distribution is not 
symmetrical, so that zero is not in the middle.
Is it somehow possible to create a color palette with white centered at zero?


The way you stated it at the beginning, I thought you should want the palette 
centered at 1 rather than 0:


Oopps ... should have the number of breaks match the number of colors:

test - seq(-1,3, len=20)
shift.BR - colorRamp(c(blue,white, red), bias=2)((1:20)/20)
tpal - rgb(shift.BR, maxColorValue=255)
barplot(test,col = tpal)




The other option, instead of adjusting the palette, is to adjust the 
breaks used by heatmap.2. Furthermore, I would recommend not to use a 
palette with the fully saturated colors you get by the approach above. 
RColorBrewer and colorspace provide better perceptually-based palettes. 
Here, I use diverge_hcl() from colorspace that gives matching perceptual 
weight to values of -1 and plus 1.


## data
set.seed(1)
my_matrix - matrix(rbeta(400, 1, 2) * 4 - 1, ncol = 20)

## color and breaks
br - seq(-3, 3, by = 0.25)
cl - diverge_hcl(length(br) - 1, power = 1)

## heatmap
heatmap.2(my_matrix, col = cl, breaks = br)


--

David Winsemius, MD
Alameda, CA, USA

__
R-help@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.



__
R-help@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.


Re: [R] Heatmap Colors

2012-09-28 Thread David Winsemius

On Sep 28, 2012, at 3:16 PM, Nick Fankhauser wrote:

 Hello R-Users!
 
 I'm using a heatmap to visualize a matrix of values between -1 and 3.
 How can I set the colors so that white is zero, below zero is blue of 
 increasing intensity towards -1 and above zero is red of increasing intensity 
 towards red?
 
 I tried like this (using the marray and gplots packages from bioconductor):
 mcol - maPalette(low=blue, mid=white, high=red,k=100)
 heatmap.2(my_matrix, col=mcol)
 
 But white does not correspond to zero, because the value distribution is not 
 symmetrical, so that zero is not in the middle.
 Is it somehow possible to create a color palette with white centered at zero?

The way you stated it at the beginning, I thought you should want the palette 
centered at 1 rather than 0:

test - seq(-1,3, len=20)
shift.BR - colorRamp(c(blue,white, red), bias=2)((1:16)/16)
tpal - rgb(shift.BR, maxColorValue=255)
barplot(test,col = tpal)

Perhaps I was being led astray by a somewhat similar question on StackOverflow.

-- 
David Winsemius, MD
Alameda, CA, USA

__
R-help@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.


Re: [R] Heatmap Colors

2012-09-28 Thread David Winsemius

On Sep 28, 2012, at 4:52 PM, David Winsemius wrote:

 
 On Sep 28, 2012, at 3:16 PM, Nick Fankhauser wrote:
 
 Hello R-Users!
 
 I'm using a heatmap to visualize a matrix of values between -1 and 3.
 How can I set the colors so that white is zero, below zero is blue of 
 increasing intensity towards -1 and above zero is red of increasing 
 intensity towards red?
 
 I tried like this (using the marray and gplots packages from bioconductor):
 mcol - maPalette(low=blue, mid=white, high=red,k=100)
 heatmap.2(my_matrix, col=mcol)
 
 But white does not correspond to zero, because the value distribution is not 
 symmetrical, so that zero is not in the middle.
 Is it somehow possible to create a color palette with white centered at zero?
 
 The way you stated it at the beginning, I thought you should want the palette 
 centered at 1 rather than 0:

Oopps ... should have the number of breaks match the number of colors:

test - seq(-1,3, len=20)
shift.BR - colorRamp(c(blue,white, red), bias=2)((1:20)/20)
tpal - rgb(shift.BR, maxColorValue=255)
barplot(test,col = tpal)
 
-- 

David Winsemius, MD
Alameda, CA, USA

__
R-help@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.


Re: [R] heatmap

2012-05-13 Thread David Winsemius


On May 13, 2012, at 11:23 AM, li li wrote:


Dear all,
  I have a data set which is 100 \times 100 matrix.
I made a heatmap of the data. The xlim and ylim
are both shown to be c(0,1). I want to make both the
xlim and ylim to be c(0,100). So the heatmap correspond to
the 100 \times 100 locations.


So just suppress the x and y tick marks and then use axis() to label  
as desired.




 Thank you.
   Hannah

[[alternative HTML version deleted]]

__
R-help@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.


David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] Heatmap fidelity

2012-04-26 Thread Duncan Murdoch

On 26/04/2012 9:01 AM, Steven Wolf wrote:

I'm having a problem when using heatmap.  Even though the diagonal of my
matrix is all the same value, the diagonal of my heatmap is not all the same
color.  Any suggestions?


heatmap() rescales the matrix by default.  Use

heatmap(abs(psim), scale=none)

to plot the raw data.

Duncan Murdoch





Here is some reproducible code:

#

# Get data

nba- read.csv(http://datasets.flowingdata.com/ppg2008.csv;, sep=,)



# Reorder

nba- nba[order(nba$PTS),]



# Name the rows and then eliminate the 1st row

row.names(nba)- nba$Name

nba- nba[,2:20]

# nba2- nba[1:10,] ## use these if you only want to look @ 10 players



# Compute how similar players are by doing a correlation between their
statistical sets

psim = cor(t(nba))

# psim2 = cor(t(nba2))



# Note: everyone has a self-correlation of 1

diag(abs(psim))

# diag(abs(psim2))



# But the diagonal doesn't always look the same

heatmap(abs(psim))

# heatmap(abs(psim2))

#



Thanks!

-Steven Wolf

Lyman Briggs College

Department of Physics and Astronomy

Michigan State University


[[alternative HTML version deleted]]

__
R-help@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.


__
R-help@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.


Re: [R] Heatmap fidelity

2012-04-26 Thread Steven Wolf
Thanks!

-Steve

-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] 
Sent: Thursday, April 26, 2012 9:28 AM
To: Steven Wolf
Cc: r-help@r-project.org
Subject: Re: [R] Heatmap fidelity

On 26/04/2012 9:01 AM, Steven Wolf wrote:
 I'm having a problem when using heatmap.  Even though the diagonal of 
 my matrix is all the same value, the diagonal of my heatmap is not all 
 the same color.  Any suggestions?

heatmap() rescales the matrix by default.  Use

heatmap(abs(psim), scale=none)

to plot the raw data.

Duncan Murdoch




 Here is some reproducible code:

 #

 # Get data

 nba- read.csv(http://datasets.flowingdata.com/ppg2008.csv;, sep=,)



 # Reorder

 nba- nba[order(nba$PTS),]



 # Name the rows and then eliminate the 1st row

 row.names(nba)- nba$Name

 nba- nba[,2:20]

 # nba2- nba[1:10,] ## use these if you only want to look @ 10 players



 # Compute how similar players are by doing a correlation between 
 their statistical sets

 psim = cor(t(nba))

 # psim2 = cor(t(nba2))



 # Note: everyone has a self-correlation of 1

 diag(abs(psim))

 # diag(abs(psim2))



 # But the diagonal doesn't always look the same

 heatmap(abs(psim))

 # heatmap(abs(psim2))

 #



 Thanks!

 -Steven Wolf

 Lyman Briggs College

 Department of Physics and Astronomy

 Michigan State University


   [[alternative HTML version deleted]]

 __
 R-help@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.

__
R-help@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.


Re: [R] heatmap.2 (blurred output heatmap)

2011-11-29 Thread Uwe Ligges
example(heatmap.2) works for me, hence it is either your data, your 
version of some package or your version of R that causes the problems, 
we do not have information of any of these although the posting guide 
asks you to provide this for each posting. So we cannot help.


Uwe Ligges


On 29.11.2011 14:45, Stuart wrote:

Hi
I used to make heatmaps using following commands but now some thing
has changed as I get

library(gplots)
heatmap.
2(qtl.map,Rowv=F,dendrogram=column,col=colorRampPalette(c(blue,lightblue,black,black,yellow,red)),breaks=seq(-4.01,4.01,length.out=51),
density.info=none, )


following error and also the ouput eatmap is also blurred so I can not
see anything! I am just wondering something has changed in package or
its just something I am getting.

Warning messages:
1: In plot.window(...) : at is not a graphical parameter
2: In plot.xy(xy, type, ...) : at is not a graphical parameter
3: In title(...) : at is not a graphical parameter

Any help would be much appreciated!

Cheers

__
R-help@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.


__
R-help@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.


Re: [R] heatmap for plotting categorical matrix

2011-10-24 Thread Yihui Xie
not sure about gplots, but the one in base R should work well if you
specify the scaling method to be 'none':

heatmap(a4[1:40, ],  Rowv=NA, Colv=NA, col=c(grey, blue, purple,
red), scale='none')

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Mon, Oct 24, 2011 at 6:07 PM, Weiwei Shi helprh...@gmail.com wrote:
 Hi there,

 I have a matrix like this:

 a4[1:20, 1:5]
           194 211 294 314 315
 GO:003   1   1   1   1   1
 GO:072   0   0   0   0   0
 GO:076   1   0   0   0   0
 GO:082   1   3   1   1   1
 GO:083   1   0   0   0   1
 GO:086   0   1   0   1   1
 GO:114   0   0   0   0   0
 GO:115   0   0   0   0   0
 GO:117   0   0   0   0   0
 GO:160   0   0   1   0   0
 GO:212   0   0   0   0   0
 GO:216   1   0   0   1   0
 GO:226   1   0   1   0   0
 GO:278   1   1   1   2   1
 GO:320   0   0   0   0   0
 GO:710   0   0   0   0   0
 GO:768   0   0   0   0   0
 GO:819   1   0   0   1   1
 GO:910   1   0   0   3   0
 GO:917   0   0   0   0   0

 I wanted to plot a heatmap to assign grey to 0, blue to 1, purple to
 2, and red to 3. I did not some trials and found some problems like this:

 When the row is all zero, there could be a white bar in the middle of the
 heatmap though I did not assign white to any value.

 Or some row believes grey as 0 while some rows believes blue as 0.

 Did I make some mistake here?

 library(gplots)

 heatmap.2(a4[1:40,],  Rowv=NA, Colv=NA, col=c(grey, blue, purple,
 red), trace=none)


 Thanks,

 Weiwei
 --
 Weiwei Shi, Ph.D
 Research Scientist


 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

        [[alternative HTML version deleted]]

 __
 R-help@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.


__
R-help@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.


Re: [R] heatmap

2011-09-06 Thread Sarah Goslee
You mean like the examples in help(heatmap) ?

On Tue, Sep 6, 2011 at 1:20 PM, Jinrui Xu jinru...@umich.edu wrote:
 Hi everyone,

 I have three numerica vectors: x, y, z. I want to plot a heatmap or surface
 plot of z against x and y. Is there any package for this? If possible,
 please drop me several lines of example code. Thanks!

 jinrui,


-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@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.


Re: [R] heatmap

2011-09-06 Thread Jinrui Xu

Hi Sarah,

To me, the heatmap function calculates density value  for each grid  
of the heatmap automatically from the input matrix. In my case, I  
already got the density value as a vector, say Z. I want to plot a  
heat map with x and y as is axsis and z values as the density of  
grid. I am not familiar with R code, so I am writting to ask how to.  
Thanks!


jinrui,

Quoting Sarah Goslee sarah.gos...@gmail.com:


You mean like the examples in help(heatmap) ?

On Tue, Sep 6, 2011 at 1:20 PM, Jinrui Xu jinru...@umich.edu wrote:

Hi everyone,

I have three numerica vectors: x, y, z. I want to plot a heatmap or surface
plot of z against x and y. Is there any package for this? If possible,
please drop me several lines of example code. Thanks!

jinrui,



--
Sarah Goslee
http://www.functionaldiversity.org







--
Ph.D Student, Bioinformatics Program
Center for Computational Medicine and Bioinformatics (CCMB)
The University of Michigan
100 Washtenaw Avenue
Ann Arbor, MI 48109-2218

1075 Natural Science Building
830 North University Avenue
Ann Arbor, MI 48109-1048
Tel (lab): 734-763-0514

http://www-personal.umich.edu/~jinruixu/

__
R-help@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.


Re: [R] heatmap

2011-09-06 Thread Gene Leynes
I wrote this function (borrowing heavily from an example from Longhow Lam)

heatplot = function(x,y,z,bgcol=#777044,coltype='heat', ccex = 1.5,
circles=TRUE, ...){
#browser()
layout(matrix(c(1, 2, 3), nc=3), widths=c(7, 1, .5))
## create the scatterplot withdifferent colors
#ccols = heat.colors(length(z))
ColFormula1 = paste(coltype, '.colors(length(z))', sep='')
ccols = eval(parse(text=ColFormula1))
bgfun=function(){
tmp = par(usr)
rect(tmp[1], tmp[3], tmp[2], tmp[4], col=bgcol)
ylimits=par()$usr[c(3,4)]
abline(h=pretty(ylimits,10), lty=2, col='black')
}
scale = function(x){(x-min(x))/diff(range(x))}
xname = deparse(substitute(x))
yname = deparse(substitute(y))
zname = deparse(substitute(z))
plot(x, y, pch=16, col=ccols[rank(z)], panel.first=bgfun(),
xlab=xname,ylab=yname, cex=ccex ,...)
if(circles){
points(x, y, cex=ccex)
}

zlim = range(z, finite=TRUE)
lvs = pretty(zlim, 20)

plot.new()
mtext(paste('legend for ', zname, ' values', sep=''), side=2)
plot.window(xlim=c(0, 1), ylim=range(lvs), xaxs=i, yaxs=i)
points(1,1,cex=5)
#rect(0, lvs[-length(lvs)],1, lvs[-1],
#col=heat.colors(length(lvs)-1))
ColFormula2 = paste(coltype, '.colors(length(lvs)-1)', sep='')
rect(.1, lvs[-length(lvs)],1, lvs[-1],
col=eval(parse(text=ColFormula2)))
axis(4)
layout(c(1))
}

## Examples:
x = 1:100
y = sin(x/50) + rnorm(100)/20
z = sort(rnorm(100))
heatplot(x,y,z)
heatplot(x,y,z, ccex=5)
heatplot(x,y,z, ccex=5, circles=F)
heatplot(x,y,z, ccex=5, circles=F, coltype='cm')
heatplot(x,y,z, ccex=5, circles=F, coltype='topo', bgcol='lavender',
main='Something Special')




On Tue, Sep 6, 2011 at 2:14 PM, Jinrui Xu jinru...@umich.edu wrote:

 Hi Sarah,

 To me, the heatmap function calculates density value  for each grid of
 the heatmap automatically from the input matrix. In my case, I already got
 the density value as a vector, say Z. I want to plot a heat map with x and
 y as is axsis and z values as the density of grid. I am not familiar with
 R code, so I am writting to ask how to. Thanks!

 jinrui,


 Quoting Sarah Goslee sarah.gos...@gmail.com:

  You mean like the examples in help(heatmap) ?

 On Tue, Sep 6, 2011 at 1:20 PM, Jinrui Xu jinru...@umich.edu wrote:

 Hi everyone,

 I have three numerica vectors: x, y, z. I want to plot a heatmap or
 surface
 plot of z against x and y. Is there any package for this? If possible,
 please drop me several lines of example code. Thanks!

 jinrui,


 --
 Sarah Goslee
 http://www.**functionaldiversity.org http://www.functionaldiversity.org






 --
 Ph.D Student, Bioinformatics Program
 Center for Computational Medicine and Bioinformatics (CCMB)
 The University of Michigan
 100 Washtenaw Avenue
 Ann Arbor, MI 48109-2218

 1075 Natural Science Building
 830 North University Avenue
 Ann Arbor, MI 48109-1048
 Tel (lab): 734-763-0514

 http://www-personal.umich.edu/**~jinruixu/http://www-personal.umich.edu/%7Ejinruixu/


 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-09 Thread Uwe Ligges



On 09.08.2011 02:32, Michael Sumner wrote:

Is it this?

https://stat.ethz.ch/pipermail/r-devel/2011-July/061540.html

Try a recent version of R 2.13.1 patched



Where it has been fixed by Duncan Murdoch.

Uwe


On Tue, Aug 9, 2011 at 1:53 AM, Colin Fordcol_f...@yahoo.com  wrote:

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 Morganmorga...@cardiff.ac.uk
To: Colin Fordcol_f...@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 Fordcol_f...@yahoo.com
To:
  r-help@r-project.org
r-help@r-project.org
Date:
  08/08/2011 13:05
Subject:
[R] heatmap
is producing unwanted horizontal and vertical lines?
Sent by:
r-help-boun...@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@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.
__
R-help@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.








__
R-help@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.


Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-09 Thread Colin Ford
Yes that sounds very much like it. I'm using R 13.1 on Windows 7 32 bit. I did 
do a search but didn't find anything - probably not using the correct search 
terms. Glad its not just me. 

Thank you,
Col.



From: Michael Sumner mdsum...@gmail.com

Cc: Peter Morgan morga...@cardiff.ac.uk; r-help@r-project.org 
r-help@r-project.org
Sent: Tuesday, 9 August 2011, 1:32
Subject: Re: [R] heatmap is producing unwanted horizontal and vertical lines?

Is it this?

https://stat.ethz.ch/pipermail/r-devel/2011-July/061540.html

Try a recent version of R 2.13.1 patched


 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 morga...@cardiff.ac.uk

 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:

 To:
  r-help@r-project.org
 r-help@r-project.org
 Date:
  08/08/2011 13:05
 Subject:
    [R] heatmap
 is producing unwanted horizontal and vertical lines?
 Sent by:
    r-help-boun...@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@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.
 __
 R-help@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.





-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-08 Thread Colin Ford
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 morga...@cardiff.ac.uk
To: Colin Ford col_f...@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_f...@yahoo.com 
To:      
 r-help@r-project.org
r-help@r-project.org 
Date:      
 08/08/2011 13:05 
Subject:    
   [R] heatmap
is producing unwanted horizontal and vertical lines? 
Sent by:    
   r-help-boun...@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@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.__
R-help@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.


Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-08 Thread David Winsemius


On Aug 8, 2011, at 11:53 AM, Colin Ford wrote:


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.


No, you haven't. Probably was an unacceptable file type.

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?


Sounds like the old problem of buggy pdf viewers relating to problems  
with anti-aliasing. Further commentary would probably be available had  
you included any machine or OS specifics,  but why not search in the  
Archives before sending further material?


Search terms likely to be productive: white lines anti-aliasing pdf

(or variations there within)

--
David




Best regards,
Col.


From: Peter Morgan morga...@cardiff.ac.uk
To: Colin Ford col_f...@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:



Date:
 08/08/2011 13:05
Subject:
   [R] heatmap
is producing unwanted horizontal and vertical lines?
Sent by:
   r-help-boun...@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.


--
David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-08 Thread Michael Sumner
Is it this?

https://stat.ethz.ch/pipermail/r-devel/2011-July/061540.html

Try a recent version of R 2.13.1 patched

On Tue, Aug 9, 2011 at 1:53 AM, Colin Ford col_f...@yahoo.com wrote:
 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 morga...@cardiff.ac.uk
 To: Colin Ford col_f...@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_f...@yahoo.com
 To:
  r-help@r-project.org
 r-help@r-project.org
 Date:
  08/08/2011 13:05
 Subject:
    [R] heatmap
 is producing unwanted horizontal and vertical lines?
 Sent by:
    r-help-boun...@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@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.
 __
 R-help@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.





-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com

__
R-help@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.


Re: [R] heatmap with RNA-Seq data

2011-07-18 Thread David Winsemius


On Jul 18, 2011, at 3:34 PM, rebioman wrote:


Hi all,
new to this forum
I'm try to using R to draw a heatmap of my RNA-seq data
before doing that I did a log2 transformation of my data and produce  
a lot

-inf in the matrix
when I try to use the heatmap function, it seems can not deal with  
the -inf
so I was wondering how to deal with these gene with 0rpkm(they are  
not 0 in

all samples, so I want to keep them in the heatmap)
thanks


?is.infinite

Could be used to replace infinities with a suitably low number, which  
can only be determined from the data context.




--
View this message in context: 
http://r.789695.n4.nabble.com/heatmap-with-RNA-Seq-data-tp3676207p3676207.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] heatmap with RNA-Seq data

2011-07-18 Thread rebioman
That what I did, I replaced the -infinite with lowest number I got from my
data set.
I'm not sure this kind of data manipulation is allowed in a publication

--
View this message in context: 
http://r.789695.n4.nabble.com/heatmap-with-RNA-Seq-data-tp3676207p3676280.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap with values

2011-06-15 Thread Jim Lemon

On 06/14/2011 08:53 PM, Agustin Lobo wrote:

Hi!
I'm displaying a contingency table with heatmap():

svm.predPix.tabla


svm.predPix CC DD LL NN NN2
 CC  22  0  3  8   3
 DD   0 27  0  1   0
 LL   1  1 90  3   7
 NN   2  0  1 11   4
 NN2  0  0  5  1  20



heatmap(svm.predPix.tabla[5:1,], Rowv=NA, Colv=NA,col =

rev(heat.colors(32)), scale=column,  margins=c(5,10))

and I'm happy with the plot except that I would like to have the actual
values displayed within each cell.  Any help on how
to achieve this?

Data in
https://sites.google.com/site/openfiles2/home/svm.predPix.tabla.rda


Hi Agustin,
I was going to send the code from color2D.matplot to display the values, 
but it required so much modification that I would suggest:


library(plotrix)
color2D.matplot(svm.predPix.tabla,show.values=TRUE,axes=FALSE,
 xlab=,ylab=)
axis(1,at=0.5:4.5,labels=rownames(svm.predPix.tabla))
axis(2,at=4.5:0.5,labels=colnames(svm.predPix.tabla))

Jim

__
R-help@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.


Re: [R] Heatmap in R and/or ggplot2

2011-06-15 Thread JiHO
On Tue, Jun 14, 2011 at 19:56, idris idris.r...@gmail.com wrote:
 Follow up question: My data contains x, y, height, and day.

 I want to create the heatmap for each day, keeping the color coding
 consistent.

 I've created an example with 2 days, and you can see the charts below.

 Notice that the legend changes from day 1 to day 2. How can I make the
 legend consistent?

 Also, my real data contains hundreds of days. Is there a way to create a
 'movie' or a sequence of the heatmaps in chronological order of days?

 The way my code works now is obviously very naive as it just repeats the
 same code for day 1 and day 2. Is there a better way to do this?

legend: use the limit argument of scale_fill_gradientn and set it to
the max and min of height across all days

movie: there is no way to do that in R alone (that I know of). you can:
1- use the jpeg or png device with a name including a special code
which increases every time a new plot is produced (this is the
default)
2- plot the successive plots in a for loop
3- turn the sequence of images into a movie using  specialized software.

For step 3 you could use guicktime on Mac OS X or mencoder on Linux/OS
X. I don't know about Windows.

Since mencoder works on the command line, you can call it from R and I
have code to ease that:
https://gitorious.org/r/r-utils/blobs/master/lib_movie.R
but you should get familiar with mencoder a little bit before trying
to read/understand it.

JiHO
---
http://maururu.net

__
R-help@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.


Re: [R] Heatmap in R and/or ggplot2

2011-06-15 Thread idris
Thanks for the tip on the limit attribute on scale_fill_gradientn.

I'll check out mencoder and let you know if I use your code for the movie.

Cheers


--
View this message in context: 
http://r.789695.n4.nabble.com/Heatmap-in-R-and-or-ggplot2-tp3594590p3600034.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Heatmap in R and/or ggplot2

2011-06-14 Thread idris
Thanks for your help!

Follow up question: My data contains x, y, height, and day.

I want to create the heatmap for each day, keeping the color coding
consistent.

I've created an example with 2 days, and you can see the charts below.

Notice that the legend changes from day 1 to day 2. How can I make the
legend consistent?

Also, my real data contains hundreds of days. Is there a way to create a
'movie' or a sequence of the heatmaps in chronological order of days? 

The way my code works now is obviously very naive as it just repeats the
same code for day 1 and day 2. Is there a better way to do this?

Thanks in advance, data from dput below.

http://r.789695.n4.nabble.com/file/n3597288/day1.png 
http://r.789695.n4.nabble.com/file/n3597288/day2.png 

#---
library(ggplot2)

#create breaks for legend
breaks-seq(0, 35, 5)

#heatmap for day 1
sdf-subset(df, day==1)
p- ggplot(sdf, aes(y,x)) 
p- p + geom_tile(aes(fill=height), colour=white)
p- p + scale_fill_gradientn(colours = c(dark red, white, dark green
), breaks=breaks, labels=format(breaks))
p- p + opts(title='Day 1')
p

#heatmap for day 1
sdf-subset(df, day==2)
p- ggplot(sdf, aes(y,x)) 
p- p + geom_tile(aes(fill=height), colour=white)
p- p + scale_fill_gradientn(colours = c(dark red, white, dark green
), breaks=breaks, labels=format(breaks))
p- p + opts(title='Day 2')
p

#--
#actual data used
structure(list(x = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 
9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L), y = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 
6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L), height = c(0L, 0L, 
0L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 
6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 10L, 10L, 
11L, 11L, 11L, 12L, 12L, 12L, 13L, 13L, 13L, 14L, 14L, 14L, 15L, 
15L, 15L, 16L, 16L, 16L, 17L, 17L, 17L, 18L, 18L, 18L, 19L, 19L, 
19L, 20L, 20L, 20L, 21L, 21L, 21L, 22L, 22L, 22L, 23L, 23L, 23L, 
24L, 24L, 24L, 25L, 25L, 25L, 26L, 26L, 26L, 27L, 27L, 27L, 28L, 
28L, 28L, 29L, 29L, 29L, 30L, 30L, 30L, 31L, 31L, 31L, 32L, 32L, 
32L, 33L, 11L, 3L, 4L, 9L, 4L, 10L, 12L, 3L, 9L, 14L, 10L, 9L, 
15L, 13L, 13L, 15L, 14L, 12L, 10L, 11L, 12L, 9L, 8L, 11L, 13L, 
12L, 13L, 15L, 19L, 19L, 12L, 19L, 14L, 22L, 21L, 12L, 13L, 18L, 
20L, 14L, 14L, 15L, 24L, 16L, 23L, 19L, 23L, 26L, 19L, 20L, 26L, 
24L, 21L, 22L, 29L, 21L, 26L, 27L, 20L, 28L, 24L, 24L, 31L, 30L, 
31L, 31L, 26L, 26L, 29L, 28L, 27L, 29L, 27L, 27L, 27L, 27L, 27L, 
35L, 28L, 29L, 34L, 32L, 38L, 32L, 34L, 37L, 32L, 30L, 34L, 30L, 
41L, 34L, 32L, 35L, 41L, 33L, 34L, 36L, 35L, 34L), day = c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L)), .Names = c(x, y, height, 

Re: [R] Heatmap in R and/or ggplot2

2011-06-13 Thread baptiste auguie
Hi,

Try this

ggplot(df, aes(x,y)) + geom_tile(aes(fill=height), colour=white) +
scale_fill_gradientn(colours = c(red, gold, green)) +
geom_text(aes(lab=height))

HTH,

baptiste

On 14 June 2011 07:12, idris idris.r...@gmail.com wrote:
 I have a dataframe df with columns x, y, and height. I want to create a
 heatmap-like plot that creates a grid of x by y, and then color codes the
 grid depending on the value of height.

 Is there a ggplot2 object to do this? I'm able to easily do this in Excel
 with pivot tables and conditional formatting so I'm including an image that
 is close to the output I want. I want to be able to customize what colors
 are used for different values of height.

 http://r.789695.n4.nabble.com/file/n3594590/heatmap.png

 Sample data included below.

 library(ggplot2)
 df -structure(list(x = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L,
 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L,
 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L,
 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L), y = c(1L,
 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L,
 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L), height = c(0L, 0L, 0L,
 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L,
 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 10L, 10L, 11L,
 11L, 11L, 12L, 12L, 12L, 13L, 13L, 13L, 14L, 14L, 14L, 15L, 15L,
 15L, 16L, 16L, 16L, 17L, 17L, 17L, 18L, 18L, 18L, 19L, 19L, 19L,
 20L, 20L, 20L, 21L, 21L, 21L, 22L, 22L, 22L, 23L, 23L, 23L, 24L,
 24L, 24L, 25L, 25L, 25L, 26L, 26L, 26L, 27L, 27L, 27L, 28L, 28L,
 28L, 29L, 29L, 29L, 30L, 30L, 30L, 31L, 31L, 31L, 32L, 32L, 32L,
 33L)), .Names = c(x, y, height), class = data.frame, row.names =
 c(NA,
 -100L))


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Heatmap-in-R-and-or-ggplot2-tp3594590p3594590.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.


__
R-help@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.


Re: [R] heatmap question

2011-06-03 Thread Mark Aquino
Yes I understand what ?text means, I meant is it possible to use this 
function (as an argument) with heatmap.2,  but I learned I can use 
add.expr=mtext() to do that.  However I'm not simply trying to add more 
text to the graph but rather move the display of the x-axis labels from the 
bottom of the chart to the top so the output would be more like:

1 2 3 4 5 6
--|1 
   |2
   |3
   |4
   |5

On Jun 2, 2011, at 10:45 PM, David Winsemius wrote:

 
 On Jun 2, 2011, at 10:42 PM, Mark Aquino wrote:
 
 Hey David,
 
 Thanks for answering, but can I use mtext with the heatmap.2 function? 
 According to the description that's not one of the arguments it takes.
 
 It's not an argument. When someone types ?something it means to look at the 
 help page for the something function which will appear if you just type 
 ?something at the console.
 
 
 Sorry if these questions are trivial, I'm very new with R, basically being 
 forced to learn it for work.
 
 
 Best,
 Mark Aquino
 On Jun 2, 2011, at 10:37 PM, David Winsemius wrote:
 
 
 On Jun 2, 2011, at 4:08 PM, Mark Aquino wrote:
 
 Hi,
 
 I have what would seem to be a very simple problem but have been unable to 
 find any way to go about solving it:
 I am using heatmap.2 to create a heatmap and by default the x axis label 
 is at the bottom of the heatmap, I simply want to move the label to the 
 top of the heatmap.
 
 ?mtext
 
 
 Any help with this would be greatly appreciated.
 
 
 -- 
 
 David Winsemius, MD
 West Hartford, CT
 
 
 
 David Winsemius, MD
 West Hartford, CT
 

__
R-help@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.


Re: [R] heatmap question

2011-06-03 Thread David Winsemius


On Jun 3, 2011, at 9:26 AM, Mark Aquino wrote:

Yes I understand what ?text means, I meant is it possible to use  
this function (as an argument) with heatmap.2,  but I learned I can  
use add.expr=mtext() to do that.  However I'm not simply trying  
to add more text to the graph but rather move the display of the x- 
axis labels from the bottom of the chart to the top so the output  
would be more like:


1 2 3 4 5 6
--|1
   |2
   |3
   |4
   |5


The help page makes me think that repositioning the x-labels (which  
would also require repositioning or suppressing the upper  
dendrogram)  would require hacking the function, since it sets up  
specific regions on the page with layout(). You should provide a  
minimal example for other readers, but I'm not going to proceed  
further since it is now clear that you are not just trying to move the  
'xlab' which was how I interpreted your initial problem description.


[ Assuming you have suppressed the column dendrogram, it may be a  
simple as changing the 1 to 3 in this line of code:


 axis(1, 1:nc, labels = labCol, las = 2, line = -0.5, tick = 0,
cex.axis = cexCol)
]

--
David




On Jun 2, 2011, at 10:45 PM, David Winsemius wrote:



On Jun 2, 2011, at 10:42 PM, Mark Aquino wrote:


Hey David,

Thanks for answering, but can I use mtext with the heatmap.2  
function? According to the description that's not one of the  
arguments it takes.


It's not an argument. When someone types ?something it means to  
look at the help page for the something function which will  
appear if you just type ?something at the console.



Sorry if these questions are trivial, I'm very new with R,  
basically being forced to learn it for work.



Best,
Mark Aquino
On Jun 2, 2011, at 10:37 PM, David Winsemius wrote:



On Jun 2, 2011, at 4:08 PM, Mark Aquino wrote:


Hi,

I have what would seem to be a very simple problem but have been  
unable to find any way to go about solving it:
I am using heatmap.2 to create a heatmap and by default the x  
axis label is at the bottom of the heatmap, I simply want to  
move the label to the top of the heatmap.


?mtext



Any help with this would be greatly appreciated.



--

David Winsemius, MD
West Hartford, CT





David Winsemius, MD
West Hartford, CT





David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] heatmap question

2011-06-03 Thread Mark Aquino
Brilliant, that's exactly what I needed.  Thank you.  The axis labels are 
duplicated on top and the bottom now though, but I'm sure there's a way to 
suppress them from appearing.
On Jun 3, 2011, at 11:24 AM, David Winsemius wrote:

 
 On Jun 3, 2011, at 9:26 AM, Mark Aquino wrote:
 
 Yes I understand what ?text means, I meant is it possible to use this 
 function (as an argument) with heatmap.2,  but I learned I can use 
 add.expr=mtext() to do that.  However I'm not simply trying to add more 
 text to the graph but rather move the display of the x-axis labels from the 
 bottom of the chart to the top so the output would be more like:
 
 1 2 3 4 5 6
 --|1
 |2
 |3
 |4
 |5
 
 The help page makes me think that repositioning the x-labels (which would 
 also require repositioning or suppressing the upper dendrogram)  would 
 require hacking the function, since it sets up specific regions on the page 
 with layout(). You should provide a minimal example for other readers, but 
 I'm not going to proceed further since it is now clear that you are not just 
 trying to move the 'xlab' which was how I interpreted your initial problem 
 description.
 
 [ Assuming you have suppressed the column dendrogram, it may be a simple as 
 changing the 1 to 3 in this line of code:
 
 axis(1, 1:nc, labels = labCol, las = 2, line = -0.5, tick = 0,
cex.axis = cexCol)
 ]
 
 -- 
 David
 
 
 
 On Jun 2, 2011, at 10:45 PM, David Winsemius wrote:
 
 
 On Jun 2, 2011, at 10:42 PM, Mark Aquino wrote:
 
 Hey David,
 
 Thanks for answering, but can I use mtext with the heatmap.2 function? 
 According to the description that's not one of the arguments it takes.
 
 It's not an argument. When someone types ?something it means to look at 
 the help page for the something function which will appear if you just 
 type ?something at the console.
 
 
 Sorry if these questions are trivial, I'm very new with R, basically being 
 forced to learn it for work.
 
 
 Best,
 Mark Aquino
 On Jun 2, 2011, at 10:37 PM, David Winsemius wrote:
 
 
 On Jun 2, 2011, at 4:08 PM, Mark Aquino wrote:
 
 Hi,
 
 I have what would seem to be a very simple problem but have been unable 
 to find any way to go about solving it:
 I am using heatmap.2 to create a heatmap and by default the x axis label 
 is at the bottom of the heatmap, I simply want to move the label to the 
 top of the heatmap.
 
 ?mtext
 
 
 Any help with this would be greatly appreciated.
 
 
 -- 
 
 David Winsemius, MD
 West Hartford, CT
 
 
 
 David Winsemius, MD
 West Hartford, CT
 
 
 
 David Winsemius, MD
 West Hartford, CT
 

__
R-help@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.


Re: [R] heatmap question

2011-06-02 Thread David Winsemius


On Jun 2, 2011, at 4:08 PM, Mark Aquino wrote:


Hi,

I have what would seem to be a very simple problem but have been  
unable to find any way to go about solving it:
I am using heatmap.2 to create a heatmap and by default the x axis  
label is at the bottom of the heatmap, I simply want to move the  
label to the top of the heatmap.


?mtext



Any help with this would be greatly appreciated.



--

David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] heatmap.3

2011-05-05 Thread elodie
I am intesrested by your heatmap function (allowing matrix in ColSideColors
option). Can you give your complete code of your function? thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/heatmap-3-tp1566584p3498156.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2 - change column row locations; angle / rotate

2011-04-18 Thread Karl Brand

Hi Chakravarthy,

[dont forget to Cc the list for useRs with the same Q.]

If you're trying to reuduce the isze of your row or column labels, i 
think the following arguments of heatmap.2 {gplots} is what you want to 
adjust- 'cexCol' and 'cexRow'.


Specifically on my question that you ask about, i found the BioC forum 
helpful:


http://permalink.gmane.org/gmane.science.biology.informatics.conductor/30112

And in fact the phylotemp() function by default pretty much did exactly 
what i needed, available here:


http://phylotemp.microeco.org/

However, it was pointed out to me  that some times the best way to get 
it just right is using more basic functions, which for heatmaps would be 
image(). See:


https://www.stat.math.ethz.ch/pipermail/bioconductor/2010-August/034995.html

hth,

karl


On 04/18/2011 10:38 AM, chakri2...@yahoo.co.in wrote:

Dear Karl Brand,

I am facing same problem as you have faced before (see appended mail below). I 
am writing to you to find out whether you have found a solution !

I asked a similar question in R-forum 
(http://r.789695.n4.nabble.com/How-to-save-heatmap-as-image-or-pdf-td3412542.html#a3413871).

Any pointers would be greatly appreciated

Thanks
Chakravarthy
Junior Research Fellow
Tata Institute of Fundamental Research
Bangalore, India

quote author='Karl Brand'
Esteemed R user's,

I'm struggling to achieve some details of a heatmap using heatmap.2():

1. Change label locations, for both rows  columns from the default
right  bottom, to left and top.
Can this be done within heatmap.2()? Or do i need to suppress this
default behavior (how) and call a new function to relabel (what)
specifying locations?

2. Change the angle of the labels.
By default column labels are 90deg anti-clock-wise from horizontal. How
to bring them back to horizontal? Or better, rotate 45deg clock-wise
from horizontal (ie., rotate 135deg a.clock.wise from default)?

Any suggestions or pointers to helpful resources greatly appreciated,

Karl



--
Karl Brand k.br...@erasmusmc.nl
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
P +31 (0)10 704 3455 | F +31 (0)10 704 4743 | M +31 (0)642 777 268

__
R-help@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.


Re: [R] heatmap-how to change the order of the rows (genes)

2011-02-09 Thread Steve Lianoglou
Hi,

On Wed, Feb 9, 2011 at 12:18 PM, yan liu yanliu...@gmail.com wrote:
 Hi,

 I have a question about the heatmap dendrogram in R.  I loaded my data
 matrix in command heatmap(), and it gave me a heatmap accordingly, and the
 rows (genes) also were clustered accordingly.  But now I don't want the
 genes clustered in that way, I have a new order of these genes, and want the
 rows of the heatmap are drawed as the order I give.  Could anybody help me
 on that?  Thank you!

Check out the docs for heatmap a bit more carefully:

R ?heatmap

I would try setting Rowv=NA, and reorder the rows of your matrix as
you want them to be ordered, ie:

R heatmap(m[my.gene.order,], Rowv=NA, ...)

Or something like that.

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

__
R-help@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.


Re: [R] heatmap-how to change the order of the rows (genes)

2011-02-09 Thread Mike Marchywka




 Date: Wed, 9 Feb 2011 12:18:57 -0500
 From: yanliu...@gmail.com
 To: r-help@r-project.org
 Subject: [R] heatmap-how to change the order of the rows (genes)

 Hi,

 I have a question about the heatmap dendrogram in R. I loaded my data
 matrix in command heatmap(), and it gave me a heatmap accordingly, and the
 rows (genes) also were clustered accordingly. But now I don't want the
 genes clustered in that way, I have a new order of these genes, and want the
 rows of the heatmap are drawed as the order I give. Could anybody help me
[[elided Hotmail spam]]




?heatmap 

Rowv=NA 
or
Colv=NA

but first time I tried this something didn't work but
I think eventually it did work for me with both, not sure
if you have problem with one only.



 Yan

 [[alternative HTML version deleted]]

 __
 R-help@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.
  
__
R-help@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.


Re: [R] Heatmap construction problems

2010-11-07 Thread Hadley Wickham
It's hard to know without a minimal reproducible example, but you
probably want scale_fill_gradient or scale_fill_gradientn.

Hadley

On Thu, Oct 28, 2010 at 9:42 AM, Struchtemeyer, Chris
stru...@okstate.edu wrote:
 I am very new to R and don't have any computer program experience
 whatsoever.  I am trying to generate a heatmap of the following data:



  Phylum,AI,AJT,BY,GA,Grt,Sm
  Acidobacteria,0.5,0.7,2.7,0.1,2.6,1.0
  Actinobacteria,33.7,65.1,9.7,2.0,3.9,2.1
  Bacteroidetes,9.7,5.6,0.7,13.2,41.1,21.6
  CCM11b,0.0,0.0,0.0,0.0,0.0,0.1
  Chlamydiae,0.1,0.1,0.0,0.0,1.0,0.2
  Chlorobi,0.0,0.0,0.0,0.0,0.7,1.0
  Chloroflexi,0.1,0.2,0.6,0.2,0.8,0.6
  Cyanobacteria,18.7,0.0,1.0,1.5,0.9,0.3
  Ellusimicrobiales,0.0,0.0,0.0,0.0,0.0,0.0
  Firmicutes,1.0,7.6,8.3,31.9,2.1,6.9
  Gemmatimonadetes,5.0,0.3,0.3,0.0,0.1,0.0
  GN02,0.0,0.0,0.0,0.0,0.0,0.5
  Nitrospirae,0.0,0.2,1.1,0.0,0.0,0.0
  NKB19,0.0,0.0,0.9,0.0,0.0,0.0
  OP8,0.0,0.1,0.0,0.0,0.0,0.0
  OP10,0.6,0.2,0.5,0.0,0.6,0.6
  Planctomycetes,0.9,0.5,6.5,2.2,2.0,2.3
  Alphaproteobacteria,7.8,10.7,21.8,12.2,5.3,26.8
  Betaproteobacteria,9.9,2.8,8.9,21.7,8.3,21.9
  Deltaproteobacteria,0.5,0.2,1.8,2.0,1.2,7.1
  Epsilonproteobacteria,0.0,0.0,0.0,0.1,0.0,0.2
  Gammaproteobacteria,4.0,2.5,8.0,9.4,24.7,5.4
  SC4,0.0,0.0,0.0,0.0,0.7,0.0
  SM2F11,0.0,0.0,0.0,0.0,0.2,0.0
  SPAM,0.0,0.1,0.0,0.0,0.1,0.1
  Synergistes,0.0,0.0,0.0,0.1,0.0,0.0
  Deinococcus-Thermus,0.0,0.0,0.0,0.0,0.0,0.0
  TM6,0.1,0.0,0.0,0.0,0.1,0.0
  TM7,0.0,0.1,0.4,0.0,0.4,0.1
  Verrucomicrobia,3.8,2.1,23.2,2.9,1.3,0.5
  WPS-2,0.0,0.0,0.1,0.0,0.0,0.0
  WS3,0.0,0.0,0.0,0.0,0.0,0.1
  Uncl Bacteria,3.7,1.2,3.7,0.4,1.9,0.8

 I am a microbiologist.  What I want to do is construct a heatmap showing the
 relative abundance of each phylum.  The far left column of my table contains
 all of the phylum names I observed in a set of 6 water samples and each of
 the columns to the right contains the relative abundance (%) of each phylum
 in each water sample.  I have tried constructing a heatmap using the ggplot
 guidelines listed at the following site:
 http://learnr.wordpress.com/2010/01/26/ggplot2-quick-heatmap-plotting/

 I can generate a heatmap using this method, but would like to alter the
 scale.  I would like it so that I can have a little more complex gradient
 ranging from 0% to the highest relative abundance that I observe in the
 above table (65.1%).  The default scale I get using the link above is just a
 relative intensity scale ranging from 1 to 5 (where white represent low
 percentages and steelblue represented high percentages).  This is alright
 but for phyla that are present at relative abundance of less than 5% all
 appear to be white (or non-existant).  Is there anyway to fix this?  Any
 help would be greatly appreciated.

 Thanks,

 Chris

 __
 R-help@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.




-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-help@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.


Re: [R] Heatmap/Color Selection(Key)

2010-10-11 Thread Eik Vettorazzi
Hi Rashid,
you may have a look at the colorRampPalette-function, along with the
at argument oh heatmap.2

x-matrix(runif(100,-6,6),nrow=10)
heatmap.2(x,col=colorRampPalette(c(blue,lightblue,darkgray,darkgray,yellow,red),space=Lab),at=c(-6.01,6.01,51))
# or just using the colors you posted
heatmap.2(x,col=c(blue,lightblue,darkgray,black,darkgray,yellow,red),at=-3:3*2)

hth.

Am 08.10.2010 17:03, schrieb rashid kazmi:
 Hi
 I made heatmap of QTL based on Lod score. Where I have traits in columns and
 marker data (rows). I can not cluster both column and rows as I need the
 right order for marker data.
 
 
 Can someone suggest me better way of generating heatmaps especially the
 colour key I want to select to visualize the results which are more
 interesting to look at.
 
 
 
 library(gplots)
 
 sample=read.csv(file.choose())
 
 sample.names-sample[,1]
 
 sample.set-sample[,-1]
 
 sample.map - as.matrix(sample.set)
 
 
 
 ### have to order as i have markers on rows so just want denrogram on
 triats(column)
 
 
 
 ord - order(rowSums(abs(sample.map)),decreasing=T)
 
 
 
 heatmap.2(sample.map[ord,],Rowv=F,dendrogram=column,trace=none,col=greenred(10))
 
 
 
 
 
 
 But I want to give colours more specifically as I want to show the QTL
 hotspots starting as fallow
 
 
 
 1)  -6  to -4 (blue)
 
 2)   -4 to -2 (light blue)
 
 3)  -2 to  0  (dark grey or black)
 
 4)  0 to 2 (dark grey or black)
 
 5)  2 to 4 (yellow)
 
 6)  4 to 6 (red)
 
 
 
 Any help or some addition to the above mentioned R code would be
 appreciated.
 
 
 
 R Kazmi
 
 PhD
 
 The Netheralnd
 
   [[alternative HTML version deleted]]
 
 __
 R-help@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.

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

__
R-help@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.


Re: [R] Heatmap/Color Selection(Key)

2010-10-11 Thread Eik Vettorazzi
sorry, typo:

 heatmap.2(x,col=colorRampPalette(c(blue,lightblue,darkgray,darkgray,yellow,red),space=Lab),at=c(-6.01,6.01,51))
 heatmap.2(x,col=c(blue,lightblue,darkgray,black,darkgray,yellow,red),at=-3:3*2)


should be read as

heatmap.2(x,col=colorRampPalette(c(blue,lightblue,darkgray,darkgray,yellow,red)),breaks=seq(-6.01,6.01,length.out=51))
heatmap.2(x,col=c(blue,lightblue,darkgray,darkgray,yellow,red),breaks=-3:3*2)

at from stats:heatmap became breaks in gplots:heatmap.2

__
R-help@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.


Re: [R] heatmap.2() yielding an inappropriate key?

2010-07-19 Thread Karl Brand

I see now my error, several in fact:

The 'breaks' specified need to be of a similar range to the data range, 
and they should be equally spaced.


So in my example:

breaks = seq(0, 0.2, 0.001)

If one needs uneqaully spaced coloring, as i do, then this is achieved 
by specifying the approprate color per bin, and repeating the same color 
as needed. Script below achives my goal. But if anyone has a simpler 
method they'd care to share- would be v. happy to receive!


karl

#achives my goal
library(gplots)
BRKS - seq(0, 0.2, 0.001)
COLS - c(rep(heat.colors(4)[1], 10),   # 0.00-0.01 bin  (10 bins)
  rep(heat.colors(4)[2], 40),   # 0.01-0.05 'bin' (40 bins)
  rep(heat.colors(4)[3], 25),   # 0.05-0.075 'bin' (25 bins)
  rep(heat.colors(4)[4], 25),   # 0.075-0.1 'bin' (25 bins)
  rep(gray, (length(BRKS)-100)-1))# 0.10-1.0 'bin' (100 bins)
set.seed(5)
mat - matrix(runif(50,  min=0, max=0.2), nrow = 10, ncol = 5)
heatmap.2(mat,
  Rowv=NULL, Colv=NULL,
  col = COLS,
  breaks = BRKS,
  trace = none,
  dendrogram = none,
  density.info = none,
  margins=c(12, 8))






On 7/19/2010 12:42 PM, Karl Brand wrote:

Esteemed R-users,

heatmap.2() is yielding an inappropriate key based on my colors and
break-points.

In the reproducible example below, the key is inappropriate (to me)
because-

1. 'Orange' is simply not represented in the key, despite its prescence
in the heatmap.
2. The proportions of the key are clearly out, ie., my largest bin, (0.1
- 0.2) is half the range, but this bin (colored gray) clearly extnds
bellow the 0.1 tick mark of the key, beyond its specified bin.

What am i missing/doing wrong? Or for a key set up like this example is
heatmap.2() unsuitable, necessitating production with another graphics
functions? If so, recommendations appreciated. I have tried ggplot2, but
struggle getting this function producing what i need. And i just need to
make a nice key at this point.

All thoughts and suggestions greatly appreciated.
cheers,

karl


#reproducible example:
library(gplots)
set.seed(5)
mat - matrix(runif(50, min=0, max=0.2), nrow = 10, ncol = 5)
heatmap.2(mat,
Rowv=NULL, Colv=NULL,
col = c(heat.colors(4, alpha = 1), gray),
breaks = c(0, 0.01, 0.05, 0.075, 0.1, 1),
trace = none,
dendrogram = none,
density.info = none,
margins=c(12, 8))



--
Karl Brand k.br...@erasmusmc.nl
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
P +31 (0)10 704 3409 | F +31 (0)10 704 4743 | M +31 (0)642 777 268

__
R-help@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.


Re: [R] heatmap.2 - ColSideColors question

2010-03-16 Thread Rainer Machne
On 03/16/2010 04:06 PM, Tim Smith wrote:
 Hi,
 
 I wanted to make more than one side color bar. 

The function heatmap.plus (library: heatmap.plus) can do that, just
combine the different color vectors with cbind(col1,col2). Unfortunately
the arguments required for heatmap, heatmap.2 and heatmap.plus are
slightly different.

r




For example, I can make one side color bar (col1) with the following code:
 ---
 library(gplots)
 
 mat - matrix(sample(1:100,40),nrow=5)
 class1 - c(rep(0,4),rep(1,4))
 col1 - ifelse(class1 == 0,blue,red)
 class2 - c(rep(1,3),rep(2,5))
 col2 - ifelse(class2 == 0,yellow,green)
 
 heatmap.2(mat,col=greenred(75),ColSideColors=col1,trace=none,
   dendrogram = column,labCol = NULL)
 
 
 ---
 How can I modify the code so that both col1  col2 are displayed in the 
 heatmap? 
 thanks!
 
 
   
   [[alternative HTML version deleted]]
 
 __
 R-help@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.

__
R-help@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.


Re: [R] Heatmap reordering of dendrogram to hierarchical clustering

2010-03-06 Thread gireesh bogu
data(warpbreaks)  ## given two factors
coplot(breaks ~ 1:54 | wool * tension, data = warpbreaks,
   col = red, bg = pink, pch = 21,
   bar.bg = c(fac = light blue))
##
conditionalplot
#



On Wed, Mar 3, 2010 at 5:40 PM, Fearon Cassidy fcass...@tcd.ie wrote:

 Dear list members,

 I have been using R to create a heatmap where my data has continous
 variables from 0 to 100.
 When I create the heatmap, although the branches are correct, they do not
 order themselves so that the row with the most zeros is at one end and the
 row with the most 100s is at the other, which is what I would like them to
 do, so as to create a colour gradient down the graphic.
 I have tried to use reorderfun to fix this, and although it makes some
 change, the heatmap still does not look how I want.

 Can you help? I have been using:

 tmp -read.table(Heat.txt,row.names=1,header=T)

 mydata - data.matrix(tmp)

 rc - rainbow(nrow(mydata),start=0, end=1)
 cc - rainbow(ncol(mydata), start=0, end=1)

 hv - heatmap(mydata, col = cm.colors(256), scale=column,
  RowSideColors = rc, ColSideColors = cc, margin=c(5,10),
xlab = Gene, ylab= Species,
main = Heatmap, reorderfun = function(mydata,w)
 reorder(mydata,0.0:100.0), Colv=NULL, Rowv=T)

 Thnak you,

 Fearon Cassidy
 Department of Zoology
 Trinity College Dublin

[[alternative HTML version deleted]]

 __
 R-help@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.




-- 
Regards

Gireesh
#HP#8375-9256

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] heatmap.3

2010-02-24 Thread joonR

If anyone is interested, I solved the problem by modifying the lhei parameter
(if ColSideColors is used, lwid for Row..) and making it parametric:

lhei=c(lhei[1], 0.1*noan, lhei[2])

where noan is an additional parameter passed to the function that specifies
the number of annotations.

best,

j
-- 
View this message in context: 
http://n4.nabble.com/heatmap-3-tp1566584p1567638.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2 color range

2010-01-26 Thread Dieter Menne


evgeny55 wrote:
 
 I'm trying to create a heatmap with color ranges for different values in
 my matrix. For example:
 If  x  5 , use orange gradient
 if  x  1.5, use red gradient
 .
 
 Right now I have the following:
 orgPal-brewer.pal(3,Oranges)
 bluPal-brewer.pal(3,Blues)
 redPal-brewer.pal(3,Reds)
 
 

I often use larger palettes (brewer.pal(7,...)) and remove the middle range.

Dieter


-- 
View this message in context: 
http://n4.nabble.com/heatmap-2-color-range-tp1293498p1305413.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2 color range

2010-01-26 Thread evgeny55

as a followup, I tried using the rainbow function to create the gradients but
is there a way to do a reverse rainbow, ie. normally if I do: 

pie(rep(1,6), col=rainbow(6,start=0, end=.07))

I'll get a gradient from dark red to orangish but what if I want it to go
the other way

thanks
-- 
View this message in context: 
http://n4.nabble.com/heatmap-2-color-range-tp1293498p1302571.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2 color range

2010-01-26 Thread evgeny55

thanks, 
I think I got the color ranges down, however, I just realized that the
colors don't match the data.  When I execute:
grad - ifelse(randMat  5,yelPal,ifelse(randMat1.5,redPal,bluPal))
the grad matrix contains the correct hex codes corresponding to the randMat
data matrix  but when I run:

heatmap(randMat, Rowv=NA, Colv=NA, col = grad, scale=none,
margins=c(5,10))

The colors displayed don't match up.  I'm not sure if it's re-ordering the
data somehow but I'm not getting any warning or errors and can't find any
similiar postings.
-- 
View this message in context: 
http://n4.nabble.com/heatmap-2-color-range-tp1293498p1311023.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2 color range

2010-01-26 Thread evgeny55

also, can you point me to some example of how to omit colors from a palette
-- 
View this message in context: 
http://n4.nabble.com/heatmap-2-color-range-tp1293498p1311031.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap/image from csv data

2009-12-10 Thread David Winsemius


On Dec 10, 2009, at 8:25 AM, Liat wrote:



Hi all,
I'm trying to use heat.map to display some data.
The data is originally in csv format and when I read it in R using
read.table I get:
 a b c d e
1 A 1 1 1 1
2 B 1 0 1 1
3 C 0 1 0 1
4 D 1 1 1 0
5 E 1 0 0 0
The problem is, that for heatmap I need a numerical matrix. When using
data.matrix I get:
a b c d e
[1,] 1 1 1 1 1
[2,] 2 1 0 1 1
[3,] 3 0 1 0 1
[4,] 4 1 1 1 0
[5,] 5 1 0 0 0
So I get numerical... but I loss the row names. I would like to see  
these

names as the y axis labels.


Look (again?)  at the help page for data.matrix.



What is the correct/easiest way of achieving this?
Many thanks!!!
--
View this message in context: 
http://n4.nabble.com/heatmap-image-from-csv-data-tp956968p956968.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@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.


Re: [R] heatmap/image from csv data

2009-12-10 Thread Liat

I have looked at the help for data.matrix. But didn't find a solution.
data.matrix only gets two arguments the data and a logical rownames.force -
I have tried to change this logical to TRUE but that doesn't help.
Any advice would be greatly appreciated.
Thanks!!

Liat wrote:
 
 Hi all,
 I'm trying to use heat.map to display some data.
 The data is originally in csv format and when I read it in R using
 read.table I get:
   a b c d e
 1 A 1 1 1 1
 2 B 1 0 1 1
 3 C 0 1 0 1
 4 D 1 1 1 0
 5 E 1 0 0 0
 The problem is, that for heatmap I need a numerical matrix. When using
 data.matrix I get:
  a b c d e
 [1,] 1 1 1 1 1
 [2,] 2 1 0 1 1
 [3,] 3 0 1 0 1
 [4,] 4 1 1 1 0
 [5,] 5 1 0 0 0
 So I get numerical... but I loss the row names. I would like to see these
 names as the y axis labels.
 What is the correct/easiest way of achieving this?
 Many thanks!!!
 

-- 
View this message in context: 
http://n4.nabble.com/heatmap-image-from-csv-data-tp956968p957059.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap/image from csv data

2009-12-10 Thread David Winsemius


On Dec 10, 2009, at 10:19 AM, Liat wrote:



I have looked at the help for data.matrix. But didn't find a solution.
data.matrix only gets two arguments the data and a logical  
rownames.force -

I have tried to change this logical to TRUE but that doesn't help.
Any advice would be greatly appreciated.
Thanks!!


I interpreted your request as wanting rownames and rownames.force=TRUE  
gives them to you, but ... you wanted the a column to be excluded  
from the data and to become the rownames? (You did not actually loose  
those rownames, but you got the coerced result on what was probably a  
factor variable. So, no reproducible data leads again to mis-targeted  
advice. Next time use dput.)


Assuming tst is your dataset name, then try:
 tmtx - data.matrix(tst[,-1])
 rownames(tmtx) - tst[,1]

 tmtx
  b c d e
A 1 1 1 1
B 1 0 1 1
C 0 1 0 1
D 1 1 1 0
E 1 0 0 0




Liat wrote:


Hi all,
I'm trying to use heat.map to display some data.
The data is originally in csv format and when I read it in R using
read.table I get:
 a b c d e
1 A 1 1 1 1
2 B 1 0 1 1
3 C 0 1 0 1
4 D 1 1 1 0
5 E 1 0 0 0
The problem is, that for heatmap I need a numerical matrix. When  
using

data.matrix I get:
a b c d e
[1,] 1 1 1 1 1
[2,] 2 1 0 1 1
[3,] 3 0 1 0 1
[4,] 4 1 1 1 0
[5,] 5 1 0 0 0
So I get numerical... but I loss the row names. I would like to see  
these

names as the y axis labels.
What is the correct/easiest way of achieving this?
Many thanks!!!



--
View this message in context: 
http://n4.nabble.com/heatmap-image-from-csv-data-tp956968p957059.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@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.


Re: [R] heatmap.2 adapting the colour scale and text overlay

2009-11-23 Thread David Winsemius


On Nov 23, 2009, at 10:02 AM, Daniel Brewer wrote:


Hello,

I am using heatmap.2 from the gplots library to plot a small  
symmetrical matrix.


This is the command:

heatmap. 
2 
(tempHeat 
,symm 
= 
T 
,trace 
=none,cexRow=0.7,cexCol=0.7,col=redgreen,density.info=none)


I have a couple of questions:
1) The range is from -0.2 to 0.4 and the colour scheme I am using is  
redgreen.  What I would like is that a zero value to be black, 0.4  
strong green and -0.2 red.  Is this possible?  At the moment around  
0.1 is black.


Perhaps:
color.palette = colorRampPalette(c(green, black, pink, red))
 heatmap.2(tempHeat,symm=T,trace=none,cexRow=0.7,cexCol=0.7,  
col=color.palette, density.info=none)


2) Is it possible to overlay text on the squares of colour?  How  
ould one go about doing that.


I am happy to use another heatmap function if ti would be better.  I  
am not using the original heatmap as it does not provide a colour key.


Thanks

Dan
--
**
Daniel Brewer, Ph.D.

Institute of Cancer Research
Molecular Carcinogenesis
Email: daniel.bre...@icr.ac.uk
**

The Institute of Cancer Research: Royal Cancer Hospital, a  
charitable Company Limited by Guarantee, Registered in England under  
Company No. 534147 with its Registered Office at 123 Old Brompton  
Road, London SW7 3RP.


This e-mail message is confidential and for use by the a...{{dropped: 
2}}


__
R-help@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.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@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.


Re: [R] heatmap.2

2009-10-14 Thread Dieter Menne



John Celniker wrote:
 
 ...
 when I try to change the breaks to:
 br2
  [1] 0.000 0.5337751 1.0675502 1.6013253 2.1351003 3.000
 3.500 4.000 4.500
 [10] 4.8039758
 
 I get the correct heatmap representation but the color key does not
  update correctly to reflect changes in breaks even though the
 superimposed histogram is correct.
 
 

This looks like the notorious 7.31 FAQ, and has been asked in the same
context already on this list (but the author did not believe it).

7.31 Why doesn't R think these numbers are equal?

Try to replace your 3.5 and 4.5000 by 3.5001 and 4.5001 or (3.4999 and
4.4999); if things work after that, 7.31 hit again. If not, my guess was
wrong.

Dieter


-- 
View this message in context: 
http://www.nabble.com/heatmap.2-tp25884655p25886190.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2() problems with re-ordering of rows and columns

2009-09-17 Thread Schalk Heunis
Hi bioinformatics_guy
I think you are looking for the image function:
image(mat)

The heatmap.2 function does hierarchical clustering on rows and columns and
then orders the rows and columns according to the results of the clustering.
 Image simply plots the matrix.

HTH
Schalk Heunis


On Thu, Sep 17, 2009 at 2:23 PM, bioinformatics_guy wwwhite...@gmail.comwrote:


 I have a file of the following form

 -11 -10 -9 -8
 -10 -9   -8   NA
 -9   -7NA NA
 -8NA  NA NA

 So basically a NxN matrix of log scores.  I want to get a heatmap of these
 log scores but I'm having a problem.

 I'm using the following code

 library(gplots)
 data=read.table(filein.txt,header=FALSE)
 mat=as.matrix(data)
 heatmap.2(mat,dendrogram=c(none))

 But on the picture, it rearranges all my row,columns.  I want it the y axis
 to be labeled from [10,-10] and the x axis to be the same [-10,10] so that
 the bottom left cell is -10,-10 and the top right cell is 10,10 -- which is
 the way the matrix is laid out.  Why is it rearranging my cells?

 --
 View this message in context:
 http://www.nabble.com/heatmap.2%28%29-problems-with-re-ordering-of-rows-and-columns-tp25490249p25490249.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] heatmap.2() problems with re-ordering of rows and columns

2009-09-17 Thread bioinformatics_guy

Schalk, 

Thats a great function! The only question is, is it as flexible as
heatmap.2?

I figured out how to get it from rearranging the rows and columns but I
can't figure out how to label the rows and columns? What I like about the
heatmap.2 is that it gives a grid and histogram of the heatmap which is
nice.

I'm trying to 

library(gplots)
data=read.table(filein.txt,header=FALSE)
mat=as.matrix(data)
heatmap.2(mat,dendrogram=c(none),trace=c(none),Rowv=F,Colv=F)

which works but labels my columns V1 thru V21 and rows 1-21.  Id like them
to be different an under the man pages for heatmap.2 it states:

 # Row/Column Labeling
  margins = c(5, 5),
  ColSideColors,
  RowSideColors,
  cexRow = 0.2 + 1/log10(nr),
  cexCol = 0.2 + 1/log10(nc),
  labRow = NULL,
  labCol = NULL,

So I'm adding cexRow=30-3(nr) (as I want it to decrement by 3 for each row
but R spits back an error say nr is not recognized.  I was looking at other
help pages but couldn't find out how to lable the axis the way I wanted to. 

Schalk Heunis wrote:
 
 Hi bioinformatics_guy
 I think you are looking for the image function:
 image(mat)
 
 The heatmap.2 function does hierarchical clustering on rows and columns
 and
 then orders the rows and columns according to the results of the
 clustering.
  Image simply plots the matrix.
 
 HTH
 Schalk Heunis
 
 
 On Thu, Sep 17, 2009 at 2:23 PM, bioinformatics_guy
 wwwhite...@gmail.comwrote:
 

 I have a file of the following form

 -11 -10 -9 -8
 -10 -9   -8   NA
 -9   -7NA NA
 -8NA  NA NA

 So basically a NxN matrix of log scores.  I want to get a heatmap of
 these
 log scores but I'm having a problem.

 I'm using the following code

 library(gplots)
 data=read.table(filein.txt,header=FALSE)
 mat=as.matrix(data)
 heatmap.2(mat,dendrogram=c(none))

 But on the picture, it rearranges all my row,columns.  I want it the y
 axis
 to be labeled from [10,-10] and the x axis to be the same [-10,10] so
 that
 the bottom left cell is -10,-10 and the top right cell is 10,10 -- which
 is
 the way the matrix is laid out.  Why is it rearranging my cells?

 --
 View this message in context:
 http://www.nabble.com/heatmap.2%28%29-problems-with-re-ordering-of-rows-and-columns-tp25490249p25490249.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.

 
   [[alternative HTML version deleted]]
 
 __
 R-help@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.
 
 

-- 
View this message in context: 
http://www.nabble.com/heatmap.2%28%29-problems-with-re-ordering-of-rows-and-columns-tp25490249p25491683.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2() problems with re-ordering of rows and columns

2009-09-17 Thread Schalk Heunis
Try placing the column names into labCol and the rownames into labRow
e.g.heatmap.2(mat,dendrogram=c(none),
Rowv=F, Colv=F, labRow = seq(-7.5,7.5,by=5), labCol=seq(-3,3,by=2))

Schalk Heunis

On Thu, Sep 17, 2009 at 3:53 PM, bioinformatics_guy wwwhite...@gmail.comwrote:


 Schalk,

 Thats a great function! The only question is, is it as flexible as
 heatmap.2?

 I figured out how to get it from rearranging the rows and columns but I
 can't figure out how to label the rows and columns? What I like about the
 heatmap.2 is that it gives a grid and histogram of the heatmap which is
 nice.

 I'm trying to

 library(gplots)
 data=read.table(filein.txt,header=FALSE)
 mat=as.matrix(data)
 heatmap.2(mat,dendrogram=c(none),trace=c(none),Rowv=F,Colv=F)

 which works but labels my columns V1 thru V21 and rows 1-21.  Id like them
 to be different an under the man pages for heatmap.2 it states:

 # Row/Column Labeling
  margins = c(5, 5),
  ColSideColors,
  RowSideColors,
  cexRow = 0.2 + 1/log10(nr),
  cexCol = 0.2 + 1/log10(nc),
  labRow = NULL,
  labCol = NULL,

 So I'm adding cexRow=30-3(nr) (as I want it to decrement by 3 for each row
 but R spits back an error say nr is not recognized.  I was looking at other
 help pages but couldn't find out how to lable the axis the way I wanted to.

 Schalk Heunis wrote:
 
  Hi bioinformatics_guy
  I think you are looking for the image function:
  image(mat)
 
  The heatmap.2 function does hierarchical clustering on rows and columns
  and
  then orders the rows and columns according to the results of the
  clustering.
   Image simply plots the matrix.
 
  HTH
  Schalk Heunis
 
 
  On Thu, Sep 17, 2009 at 2:23 PM, bioinformatics_guy
  wwwhite...@gmail.comwrote:
 
 
  I have a file of the following form
 
  -11 -10 -9 -8
  -10 -9   -8   NA
  -9   -7NA NA
  -8NA  NA NA
 
  So basically a NxN matrix of log scores.  I want to get a heatmap of
  these
  log scores but I'm having a problem.
 
  I'm using the following code
 
  library(gplots)
  data=read.table(filein.txt,header=FALSE)
  mat=as.matrix(data)
  heatmap.2(mat,dendrogram=c(none))
 
  But on the picture, it rearranges all my row,columns.  I want it the y
  axis
  to be labeled from [10,-10] and the x axis to be the same [-10,10] so
  that
  the bottom left cell is -10,-10 and the top right cell is 10,10 -- which
  is
  the way the matrix is laid out.  Why is it rearranging my cells?
 
  --
  View this message in context:
 
 http://www.nabble.com/heatmap.2%28%29-problems-with-re-ordering-of-rows-and-columns-tp25490249p25490249.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@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.
 
 
[[alternative HTML version deleted]]
 
  __
  R-help@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.
 
 

 --
 View this message in context:
 http://www.nabble.com/heatmap.2%28%29-problems-with-re-ordering-of-rows-and-columns-tp25490249p25491683.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] heatmap plot

2009-07-21 Thread Michael Knudsen
2009/7/21 Markus Mühlbacher muehli...@yahoo.com:

 So just that I understand right. x and y are the scalings of the x and y axis 
 and the matrix represents the color of the points at each gridpoint?

Precisely! Try ?image for more details.

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.com/

__
R-help@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.


Re: [R] heatmap plot

2009-07-21 Thread Michael Knudsen
2009/7/21 Markus Mühlbacher muehli...@yahoo.com:

 I tried to add white to the colors, but this did not change my problem. Still 
 the values of the diagonal seem to be different from those occurring in the 
 matrix. Or in other words all squares of the diagonal should have to SAME 
 color!

If you can send me the matrix as a text file -- ready to import in R
-- I can give it a try.

Best,
Michael

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.com/

__
R-help@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.


Re: [R] heatmap plot

2009-07-20 Thread Michael Knudsen
2009/7/20 Markus Mühlbacher muehli...@yahoo.com:

 What is my mistake?

I don't know about the heatmap function, but I have often used 'image'
with 'heat.colors' without any problems. There is a nice example here:

http://addictedtor.free.fr/graphiques/graphcode.php?graph=20

It should be fairly easy to fit your data into that one. I guess that
this should work:

x = 1:length(activity.matrix)
y = 1:length(activity.matrix)
image(x, y, activity.matrix, col=heat.colors(100))

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.com/

__
R-help@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.


Re: [R] heatmap plot

2009-07-20 Thread Michael Knudsen
2009/7/20 Markus Mühlbacher muehli...@yahoo.com:

 Gives the attached image. Again I am missing the white diagonal. Is there 
 some kind of sorting that I do not consider?

Maybe col=c(white,heat.colors(100)) will do the trick?

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.com/

__
R-help@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.


Re: [R] heatmap plot

2009-07-20 Thread 1Rnwb

since heatmap is a graphic image it needs the graphics library. you can see
these two in the examples for heatmap.

require(graphics); require(grDevices)


Markus Mühlbacher wrote:
 
 Dear R community!
 
 I am trying to create a heatmap based on the following data. As you can
 see the diagonal (0,0 to 10,10) is always 0). If I run the heatmap command
 like i posted it I get a graph with horizontal lines. 
 
 What is my mistake?
 
 heatmap(activity.matrix, Rowv = NA, Colv = NA, scale=column, xlab=x
 Compounds, ylab=y Compounds, col=topo.colors(100))
 activity.matrix
 [,1]   [,2]   [,3][,4]  [,5]   [,6]
  [1,]  0.000 -0.1017802  0.3635007  0.62522118 0.8869417 -0.4652809
  [2,]  0.1017802  0.000  0.4652809  0.72700138 0.9887219 -0.3635007
  [3,] -0.3635007 -0.4652809  0.000  0.26172050 0.5234410 -0.8287816
  [4,] -0.6252212 -0.7270014 -0.2617205  0. 0.2617205 -1.0905021
  [5,] -0.8869417 -0.9887219 -0.5234410 -0.26172050 0.000 -1.356
  [6,]  0.4652809  0.3635007  0.8287816  1.09050206 1.356  0.000
  [7,] -0.2471805 -0.3489607  0.1163202  0.37804072 0.6397612 -0.7124613
  [8,]  1.0032619  0.9014817  1.3667626  1.62848308 1.8902036  0.5379810
  [9,] -0.6833813 -0.7851615 -0.3198806 -0.05816011 0.2035604 -1.1486622
 [10,]  1.0759620  0.9741818  1.4394627  1.70118322 1.9629037  0.6106812
 [,7][,8][,9]   [,10]
  [1,]  0.2471805 -1.00326190  0.68338129 -1.07596204
  [2,]  0.3489607 -0.90148171  0.78516149 -0.97418184
  [3,] -0.1163202 -1.36676259  0.31988061 -1.43946272
  [4,] -0.3780407 -1.62848308  0.05816011 -1.70118322
  [5,] -0.6397612 -1.89020358 -0.20356039 -1.96290371
  [6,]  0.7124613 -0.53798102  1.14866217 -0.61068116
  [7,]  0.000 -1.25044237  0.43620083 -1.32314250
  [8,]  1.2504424  0.  1.68664319 -0.07270014
  [9,] -0.4362008 -1.68664319  0. -1.75934333
 [10,]  1.3231425  0.07270014  1.75934333  0.
 
 Thanks in advance. 
 
 Greets, 
 Markus
 
 
 
 
 __
 R-help@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.
 
 

-- 
View this message in context: 
http://www.nabble.com/heatmap-plot-tp24572168p24574102.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] heatmap.2: question regarding the raw z-score

2009-07-09 Thread Chrysanthi A.
Thanks a lot..! What exactly the sweep function is doing? Also, is there a
possibility instead of using the mean of the whole row to get only the mean
of a group of the row values? So the values in the matrix (heat map) used in
the comparison are z-scores and not the intensities of the gene expressions,
right?

Also, as I can understand from the code, heatmap is using distfun function
for the clusering. Can I use pearson correlation for the clustering? My main
object of using the heatmap is to examine the expression levels of the
marker genes and to confirm that the marker genes are clearly differentially
expressed in the two subtypes of the disease that I examine.

Many thanks,

Chrysanthi.


2009/7/8 James W. MacDonald jmac...@med.umich.edu

 Hi Chrysanthi,


 Chrysanthi A. wrote:

 Hi,

 I am analysing gene expression data using the heatmap.2 function in R and
 I
 was wondering what is the formula of the raw z-score bar which shows the
 colors for each pixel.
 According to that post:
 https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html,
 it
 is the

 (actual value - mean of the group) / standard deviation.

 But, mean of which group? Mean of the gene vector? And actual value of
 that
 gene on a sample?  I would be grateful if you could give me some more
 details about it or even if there is a book/manual that I could address
 to..


 How about looking at the code?

if (scale == row) {
retval$rowMeans - rm - rowMeans(x, na.rm = na.rm)
x - sweep(x, 1, rm)
retval$rowSDs - sx - apply(x, 1, sd, na.rm = na.rm)
x - sweep(x, 1, sx, /)
}
else if (scale == column) {
retval$colMeans - rm - colMeans(x, na.rm = na.rm)
x - sweep(x, 2, rm)
retval$colSDs - sx - apply(x, 2, sd, na.rm = na.rm)
x - sweep(x, 2, sx, /)
}

 So the z-score is calculated on either the row or column (or the default of
 none).

 I don't see how you can get something saying 'raw z-score'. I get either
 'Row Z-Score' or 'Column Z-Score'. So assuming you meant Row Z-Score, then
 the rows are centered and scaled by subtracting the mean of the row from
 every value and then dividing the resulting values by the standard deviation
 of the row.

 Best,

 Jim



 Thanks a lot,

 Chrysanthi.

 *
 *

[[alternative HTML version deleted]]

 __
 R-help@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.


 --
 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


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] heatmap.2: question regarding the raw z-score

2009-07-09 Thread James W. MacDonald

Hi Chrysanthi,

Chrysanthi A. wrote:


Thanks a lot..! What exactly the sweep function is doing? Also, is there 
a possibility instead of using the mean of the whole row to get only the 
mean of a group of the row values? So the values in the matrix (heat 
map) used in the comparison are z-scores and not the intensities of the 
gene expressions, right? 


I was trying to give a subtle hint below, but maybe I should be a bit 
more blunt. One of the coolest things about R is that it is free, and 
there are these sweet listservs where people give advice and help for 
free as well.


HOWEVER, there is still a price to pay, and that is with your time. All 
of these functions have help pages that the developers spent time 
writing, and the code is there for you to peruse. Because of this, there 
is some expectation that you would have done so prior to asking 
questions. Now I have read the help page for sweep, and quite frankly it 
is a bit confusing. The term 'sweep' is used without definition, so if 
one doesn't know what that means the help page is less than helpful. But 
it doesn't take much time or effort to empirically see what it does:


 a - matrix(rnorm(25), ncol=5)
 a
   [,1]   [,2]   [,3][,4][,5]
[1,]  0.6841637 -1.0590185 -0.1719887 -0.01916011 -1.61936817
[2,]  0.5707217  1.4790968  1.6736991 -0.72158518  1.22467334
[3,]  0.4440499 -0.3382888 -0.1504191  0.32140022  1.83780859
[4,] -0.6659568  3.0573678 -1.5709904 -1.35618488 -0.01717017
[5,] -0.3182206  2.2777597 -0.2325356 -0.02001414  1.77440090
 rm - rowMeans(a)
 rm
[1] -0.4370743  0.8453211  0.4229102 -0.1105869  0.6962780
 sweep(a, 1, rm, -)
[,1]   [,2]   [,3]   [,4][,5]
[1,]  1.12123808 -0.6219441  0.2650857  0.4179142 -1.18229384
[2,] -0.27459943  0.6337756  0.8283779 -1.5669063  0.37935220
[3,]  0.02113977 -0.7611990 -0.5733293 -0.1015100  1.41489842
[4,] -0.55536988  3.1679546 -1.4604035 -1.2455980  0.09341672
[5,] -1.01449866  1.5814817 -0.9288137 -0.7162922  1.07812286

For your second question:

?heatmap.2




Also, as I can understand from the code, heatmap is using distfun 
function for the clusering. Can I use pearson correlation for the 
clustering? My main object of using the heatmap is to examine the 
expression levels of the marker genes and to confirm that the marker 
genes are clearly differentially expressed in the two subtypes of the 
disease that I examine.


No, heatmap.2() is not using distfun for the clustering. There isn't a 
function by that name in either gplots nor base R. If you look at the 
help page, you can see that distfun is an argument to the function, and 
the default is to use the dist() function.


You can use Pearson correlation, but in my experience it takes some 
work. Again, if you read the help page, you can see that the Rowv and 
Colv arguments can be one of TRUE, FALSE, NULL, or a dendrogram. So if 
you want to use Pearson correlation, you should supply heatmap.2() with 
dendrograms produced using that correlation. So an example:


a - matrix(rnorm(50), ncol=5)
rowv - as.dendrogram(hclust(as.dist(1-cor(t(a)
colv - as.dendrogram(hclust(as.dist(1-cor(a
heatmap.2(a, scale=row, Rowv=rowv, Colv=colv)

Best,

Jim





Many thanks,

Chrysanthi.


2009/7/8 James W. MacDonald jmac...@med.umich.edu 
mailto:jmac...@med.umich.edu


Hi Chrysanthi,


Chrysanthi A. wrote:

Hi,

I am analysing gene expression data using the heatmap.2 function
in R and I
was wondering what is the formula of the raw z-score bar which
shows the
colors for each pixel.
According to that post:

https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html,
it
is the

(actual value - mean of the group) / standard deviation.

But, mean of which group? Mean of the gene vector? And actual
value of that
gene on a sample?  I would be grateful if you could give me some
more
details about it or even if there is a book/manual that I could
address
to..


How about looking at the code?

   if (scale == row) {
   retval$rowMeans - rm - rowMeans(x, na.rm = na.rm)
   x - sweep(x, 1, rm)
   retval$rowSDs - sx - apply(x, 1, sd, na.rm = na.rm)
   x - sweep(x, 1, sx, /)
   }
   else if (scale == column) {
   retval$colMeans - rm - colMeans(x, na.rm = na.rm)
   x - sweep(x, 2, rm)
   retval$colSDs - sx - apply(x, 2, sd, na.rm = na.rm)
   x - sweep(x, 2, sx, /)
   }

So the z-score is calculated on either the row or column (or the
default of none).

I don't see how you can get something saying 'raw z-score'. I get
either 'Row Z-Score' or 'Column Z-Score'. So assuming you meant Row
Z-Score, then the rows are centered and scaled by subtracting the
mean of the row from every value and then dividing the resulting
values 

Re: [R] heatmap.2: question regarding the raw z-score

2009-07-08 Thread James W. MacDonald

Hi Chrysanthi,

Chrysanthi A. wrote:

Hi,

I am analysing gene expression data using the heatmap.2 function in R and I
was wondering what is the formula of the raw z-score bar which shows the
colors for each pixel.
According to that post:
https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html, it
is the

(actual value - mean of the group) / standard deviation.

But, mean of which group? Mean of the gene vector? And actual value of that
gene on a sample?  I would be grateful if you could give me some more
details about it or even if there is a book/manual that I could address
to..


How about looking at the code?

if (scale == row) {
retval$rowMeans - rm - rowMeans(x, na.rm = na.rm)
x - sweep(x, 1, rm)
retval$rowSDs - sx - apply(x, 1, sd, na.rm = na.rm)
x - sweep(x, 1, sx, /)
}
else if (scale == column) {
retval$colMeans - rm - colMeans(x, na.rm = na.rm)
x - sweep(x, 2, rm)
retval$colSDs - sx - apply(x, 2, sd, na.rm = na.rm)
x - sweep(x, 2, sx, /)
}

So the z-score is calculated on either the row or column (or the default 
of none).


I don't see how you can get something saying 'raw z-score'. I get either 
'Row Z-Score' or 'Column Z-Score'. So assuming you meant Row Z-Score, 
then the rows are centered and scaled by subtracting the mean of the row 
from every value and then dividing the resulting values by the standard 
deviation of the row.


Best,

Jim




Thanks a lot,

Chrysanthi.

*
*

[[alternative HTML version deleted]]

__
R-help@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.


--
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

__
R-help@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.


Re: [R] Heatmap

2009-06-08 Thread Liaw, Andy
Couldn't you get that just by giving heatmap() the transpose of your
data? 

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Alex Roy
 Sent: Monday, June 08, 2009 9:32 AM
 To: r-help@r-project.org
 Subject: [R] Heatmap
 
 Hello Group,
 How can I draw heatmap with variable 
 names in the plot?
 
 Thanks
 
 Alex
 
   [[alternative HTML version deleted]]
 
 __
 R-help@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.
 
Notice:  This e-mail message, together with any attachme...{{dropped:12}}

__
R-help@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.


Re: [R] Heatmap

2009-06-08 Thread Jorge Ivan Velez
Dear Alex,
Take a look at the examples in

# Option 1
?heatmap

# Option 2
require(gplots)
?heatmap.2

HTH,

Jorge


On Mon, Jun 8, 2009 at 9:32 AM, Alex Roy alexroy2...@gmail.com wrote:

 Hello Group,
How can I draw heatmap with variable names in the plot?

 Thanks

 Alex

[[alternative HTML version deleted]]

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap without levelplot

2009-05-06 Thread Antje

Hi Uwe,

thanks a lot for your answer! And thanks a lot to all others helping me with 
this issue!


Uwe Ligges schrieb:



Antje wrote:

Hi Uwe,

I tried to explain my problem with the given example.
I don't see any documentation which tells me that the length of 
col.regions should be one less than at. (At least I assume now 
that it should be this way...)
If it's equal or longer some colors (in the middle of the 
color-vector) are simply not used.
Just try the example below with rainbow(5) and rainbow(6) and compare 
the results... both plot will use 5 colors!
Sorry, but this behaviour is not really self-explaining to me... maybe 
I'm to blind to find the documentation which says that only one color 
less will ensure the usage of all colors.


Well, of you have 5 at locations (i.e. breaks), then you have 4 
intervals in between and that's the amount of colors that is sensible.


From the documentation this was not really clear to me (though it makes sense, 
I agree)





(It is so important for me because I need to display a heatmap with 
colors let's say

* all lower data outliers green,
* all higher data outliers blue and
* everything else within the color range yellow to red.
I've seen that some values do not get blue or green though they are 
outliers...

I've attached one graph, I've generated - maybe it helps to understand)

Any wrong assumption?


Maybe:

Say you want everything below -1 be considered as a lower outlier and 
all above 1 is a higher outlier, then you can say:



levelplot(matrix(c(1,2,0,-2), nrow=2),
at = c(-Inf, seq(-1, 1, length=10), Inf),
col.regions = c(rgb(0,1,0),
 hcl(seq(20, 80, length=10), c=400),
 rgb(0,0,1)))

Then below -1 is green (rgb(0,1,0)), above 1 is blue (rgb(0,0,1)) and in 
between we have 10 regions from -1 to 1 each with a color between some 
kind of yellow and red in hcl() space.


Thank you for this little example. Just two comments:

1) I was not aware of the possibility to use Inf - it just has the 
disadvantage that these colors are not displayed at the color vector (maybe 
this can be adjusted somehow)


2) if you replace one number of the matrix with -1, it will be displayed green.
So it would be considered as an outlier. From the documentation it was also not 
clear to me that the lower endpoint of the interval is always excluded (except 
for the very first value of the at-vector), while the upper endpoint will be 
included. (This also makes sense but in this case I have to slightly modify my 
data because I'd like to include both endpoints of my non-outlier-range...)


Anyway, I guess, I solved all problems and found a workable solution :-)

Ciao,
Antje





Uwe Ligges





Ciao,
Antje


Uwe Ligges schrieb:



Antje wrote:

Hi there,

as I'm not sure to understand the coloring levelplot uses, I'm 
looking for another easy way to create a heatmap like this:


library(lattice)
mat - matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] - 3.5

my.at - seq(0.5,5.5, length.out = 6)
my.col.regions - rainbow(5)

graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
my.col.regions)

print(graph)

Can anybody help me with some hints or little examples?



Dear Antje,

since you are asking the same question again now, maybe you can 
explain what you are going to get? In fact, I do not undertsand where 
your problem is. R places the colors according to the values in your 
matrix very well including the legend and I thought up to today that 
the plot is self explaining.


Best wishes,
Uwe Ligges





Antje

__
R-help@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.








__
R-help@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.


Re: [R] Heatmap without levelplot

2009-05-06 Thread Uwe Ligges



Antje wrote:

Hi Uwe,

thanks a lot for your answer! And thanks a lot to all others helping me 
with this issue!


Uwe Ligges schrieb:



Antje wrote:

Hi Uwe,

I tried to explain my problem with the given example.
I don't see any documentation which tells me that the length of 
col.regions should be one less than at. (At least I assume now 
that it should be this way...)
If it's equal or longer some colors (in the middle of the 
color-vector) are simply not used.
Just try the example below with rainbow(5) and rainbow(6) and compare 
the results... both plot will use 5 colors!
Sorry, but this behaviour is not really self-explaining to me... 
maybe I'm to blind to find the documentation which says that only one 
color less will ensure the usage of all colors.


Well, of you have 5 at locations (i.e. breaks), then you have 4 
intervals in between and that's the amount of colors that is sensible.


 From the documentation this was not really clear to me (though it makes 
sense, I agree)





(It is so important for me because I need to display a heatmap with 
colors let's say

* all lower data outliers green,
* all higher data outliers blue and
* everything else within the color range yellow to red.
I've seen that some values do not get blue or green though they are 
outliers...

I've attached one graph, I've generated - maybe it helps to understand)

Any wrong assumption?


Maybe:

Say you want everything below -1 be considered as a lower outlier and 
all above 1 is a higher outlier, then you can say:



levelplot(matrix(c(1,2,0,-2), nrow=2),
at = c(-Inf, seq(-1, 1, length=10), Inf),
col.regions = c(rgb(0,1,0),
 hcl(seq(20, 80, length=10), c=400),
 rgb(0,0,1)))

Then below -1 is green (rgb(0,1,0)), above 1 is blue (rgb(0,0,1)) and 
in between we have 10 regions from -1 to 1 each with a color between 
some kind of yellow and red in hcl() space.


Thank you for this little example. Just two comments:

1) I was not aware of the possibility to use Inf - it just has the 
disadvantage that these colors are not displayed at the color vector 
(maybe this can be adjusted somehow)


2) if you replace one number of the matrix with -1, it will be displayed 
green.
So it would be considered as an outlier. From the documentation it was 
also not clear to me that the lower endpoint of the interval is always 
excluded (except for the very first value of the at-vector), while the 
upper endpoint will be included. (This also makes sense but in this case 
I have to slightly modify my data because I'd like to include both 
endpoints of my non-outlier-range...)



You can add or substract .Machine$double.eps to the endpoint in order to 
in/exclude the == case.


Uwe Ligges




Anyway, I guess, I solved all problems and found a workable solution :-)

Ciao,
Antje





Uwe Ligges





Ciao,
Antje


Uwe Ligges schrieb:



Antje wrote:

Hi there,

as I'm not sure to understand the coloring levelplot uses, I'm 
looking for another easy way to create a heatmap like this:


library(lattice)
mat - matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] - 3.5

my.at - seq(0.5,5.5, length.out = 6)
my.col.regions - rainbow(5)

graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions 
= my.col.regions)

print(graph)

Can anybody help me with some hints or little examples?



Dear Antje,

since you are asking the same question again now, maybe you can 
explain what you are going to get? In fact, I do not undertsand 
where your problem is. R places the colors according to the values 
in your matrix very well including the legend and I thought up to 
today that the plot is self explaining.


Best wishes,
Uwe Ligges





Antje

__
R-help@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.










__
R-help@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.


Re: [R] Heatmap: draw horizontal line

2009-05-06 Thread Matthias Kohl

Is

heatmap.2(mat,Rowv=NA,trace = 'none',key=F, add.expr = abline(h = 
c(3.5,5.5), lwd = 3))


what your are looking for?

hth,
Matthias

Paul Evans schrieb:

Hi,

I wanted to draw a heatmap with some horizontal lines. For example:

#-- code --
mat - matrix(-1:1,7,9)
heatmap.2(mat,Rowv=NA,trace = 'none',key=F)

#end code -

In this heatmap, I want to subgroup the rows. For instance, I would like to group rows 5,6 
 7 together, and would draw a black line between rows 4  5 to demarcate the group. 
Similarly, I want to group rows 3  4 in one group, and would like to put a black line 
between rows 2  3.

I guess I'm looking for the 'hline' parameter or something, but couldn't find 
it in the documentation.

Any help would be appreciated!



  
	[[alternative HTML version deleted]]


__
R-help@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.
  


--
Dr. Matthias Kohl
www.stamats.de

__
R-help@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.


Re: [R] Heatmap: draw horizontal line

2009-05-06 Thread Paul Evans
Thanks Matthias! Exactly what I was looking for.

Paul





From: Matthias Kohl matthias.k...@stamats.de

Cc: r-h...@stat.math.ethz.ch
Sent: Wednesday, May 6, 2009 2:06:22 PM
Subject: Re: [R] Heatmap: draw horizontal line

Is

heatmap.2(mat,Rowv=NA,trace = 'none',key=F, add.expr = abline(h = 
c(3.5,5.5), lwd = 3))

what your are looking for?

hth,
Matthias

Paul Evans schrieb:
 Hi,

 I wanted to draw a heatmap with some horizontal lines. For example:

 #-- code --
 mat - matrix(-1:1,7,9)
 heatmap.2(mat,Rowv=NA,trace = 'none',key=F)

 #end code -

 In this heatmap, I want to subgroup the rows. For instance, I would like to 
 group rows 5,6  7 together, and would draw a black line between rows 4  5 
 to demarcate the group. Similarly, I want to group rows 3  4 in one group, 
 and would like to put a black line between rows 2  3.

 I guess I'm looking for the 'hline' parameter or something, but couldn't find 
 it in the documentation.

[[elided Yahoo spam]]



  
 [[alternative HTML version deleted]]

 __
 R-help@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.
  

-- 
Dr. Matthias Kohl
www.stamats.de


  
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Heatmap without levelplot

2009-05-05 Thread Dieter Menne
Antje niederlein-rstat at yahoo.de writes:

 as I'm not sure to understand the coloring levelplot uses, I'm looking for 
 another easy way to create a heatmap like this:
 
 library(lattice)
 mat - matrix(seq(1,5, length.out = 12), nrow = 3)
 mat[1,2] - 3.5
 
 my.at - seq(0.5,5.5, length.out = 6)
 my.col.regions - rainbow(5)
 
 graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
 my.col.regions)
 print(graph)
 

Looks fine to me, so what's wrong? Maybe have a look at RColorBrewer
to get more pleasing colors.

Dieter

__
R-help@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.


Re: [R] Heatmap without levelplot

2009-05-05 Thread Antje

Hi Uwe,

I tried to explain my problem with the given example.
I don't see any documentation which tells me that the length of col.regions 
should be one less than at. (At least I assume now that it should be this way...)
If it's equal or longer some colors (in the middle of the color-vector) are 
simply not used.
Just try the example below with rainbow(5) and rainbow(6) and compare the 
results... both plot will use 5 colors!
Sorry, but this behaviour is not really self-explaining to me... maybe I'm to 
blind to find the documentation which says that only one color less will ensure 
the usage of all colors.


(It is so important for me because I need to display a heatmap with colors 
let's say

* all lower data outliers green,
* all higher data outliers blue and
* everything else within the color range yellow to red.
I've seen that some values do not get blue or green though they are outliers...
I've attached one graph, I've generated - maybe it helps to understand)

Any wrong assumption?

Ciao,
Antje


Uwe Ligges schrieb:



Antje wrote:

Hi there,

as I'm not sure to understand the coloring levelplot uses, I'm looking 
for another easy way to create a heatmap like this:


library(lattice)
mat - matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] - 3.5

my.at - seq(0.5,5.5, length.out = 6)
my.col.regions - rainbow(5)

graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
my.col.regions)

print(graph)

Can anybody help me with some hints or little examples?



Dear Antje,

since you are asking the same question again now, maybe you can explain 
what you are going to get? In fact, I do not undertsand where your 
problem is. R places the colors according to the values in your matrix 
very well including the legend and I thought up to today that the plot 
is self explaining.


Best wishes,
Uwe Ligges





Antje

__
R-help@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.




__
R-help@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.


Re: [R] Heatmap without levelplot

2009-05-05 Thread Greg Snow
The image function in base graphics does the same type of plot, just different 
names and structure of the data (and the documentation says that the number of 
breaks should be 1 more than the number of colors).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Antje
 Sent: Tuesday, May 05, 2009 1:12 AM
 To: r-h...@stat.math.ethz.ch
 Subject: [R] Heatmap without levelplot
 
 Hi there,
 
 as I'm not sure to understand the coloring levelplot uses, I'm looking
 for
 another easy way to create a heatmap like this:
 
 library(lattice)
 mat - matrix(seq(1,5, length.out = 12), nrow = 3)
 mat[1,2] - 3.5
 
 my.at - seq(0.5,5.5, length.out = 6)
 my.col.regions - rainbow(5)
 
 graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions =
 my.col.regions)
 print(graph)
 
 Can anybody help me with some hints or little examples?
 
 Antje
 
 __
 R-help@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.

__
R-help@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.


Re: [R] Heatmap without levelplot

2009-05-05 Thread Uwe Ligges



Antje wrote:

Hi Uwe,

I tried to explain my problem with the given example.
I don't see any documentation which tells me that the length of 
col.regions should be one less than at. (At least I assume now that 
it should be this way...)
If it's equal or longer some colors (in the middle of the color-vector) 
are simply not used.
Just try the example below with rainbow(5) and rainbow(6) and compare 
the results... both plot will use 5 colors!
Sorry, but this behaviour is not really self-explaining to me... maybe 
I'm to blind to find the documentation which says that only one color 
less will ensure the usage of all colors.


Well, of you have 5 at locations (i.e. breaks), then you have 4 
intervals in between and that's the amount of colors that is sensible.



(It is so important for me because I need to display a heatmap with 
colors let's say

* all lower data outliers green,
* all higher data outliers blue and
* everything else within the color range yellow to red.
I've seen that some values do not get blue or green though they are 
outliers...

I've attached one graph, I've generated - maybe it helps to understand)

Any wrong assumption?


Maybe:

Say you want everything below -1 be considered as a lower outlier and 
all above 1 is a higher outlier, then you can say:



levelplot(matrix(c(1,2,0,-2), nrow=2),
at = c(-Inf, seq(-1, 1, length=10), Inf),
col.regions = c(rgb(0,1,0),
 hcl(seq(20, 80, length=10), c=400),
 rgb(0,0,1)))

Then below -1 is green (rgb(0,1,0)), above 1 is blue (rgb(0,0,1)) and in 
between we have 10 regions from -1 to 1 each with a color between some 
kind of yellow and red in hcl() space.



Uwe Ligges





Ciao,
Antje


Uwe Ligges schrieb:



Antje wrote:

Hi there,

as I'm not sure to understand the coloring levelplot uses, I'm 
looking for another easy way to create a heatmap like this:


library(lattice)
mat - matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] - 3.5

my.at - seq(0.5,5.5, length.out = 6)
my.col.regions - rainbow(5)

graph - levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
my.col.regions)

print(graph)

Can anybody help me with some hints or little examples?



Dear Antje,

since you are asking the same question again now, maybe you can 
explain what you are going to get? In fact, I do not undertsand where 
your problem is. R places the colors according to the values in your 
matrix very well including the legend and I thought up to today that 
the plot is self explaining.


Best wishes,
Uwe Ligges





Antje

__
R-help@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.






__
R-help@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.


Re: [R] heatmap.2 no reordering of the columns and rows

2009-04-07 Thread James W. MacDonald

Hi Tanuja,

Tanuja Bompada wrote:

Hi,
  I need to generate a heatmap on a square matrix and wouldn't want to reorder the columns and the rows on the heatmap display.  
  I have used the options Rowv=NULL and Colv=NULL but doesn't seem to work. Following is a snippet of the heatmap function i am using.


args - commandArgs();
inputfile - args[2]
imgfile   - args[3]

bitmap(imgfile, height=15, width=15, res=100, pointsize=9)

library(gplots)
library(RColorBrewer)
data - read.table(inputfile)
matrix - as.matrix(data)
cp - colorRampPalette(c(red,yellow,darkgreen),space=Lab, bias=1.5)
heatmap.2(matrix, Colv=1:ncol(matrix), dendogram=row, hclustfun=function(m) 
hclust(m,method=complete),col=cp(25),scale=none,trace=none,keysize=1,margins=c(5,12),
 cexCol=1, cexRow=1)
q()
dev.off()

The alternative that i tried to avoid the reordering was 


heatmap.2(matrix, Rowv=NULL, Colv=NULL, col=cp(25), scale=none, trace=none, 
keysize=1, margins=c(5,12), cexCol=1, cexRow=1)


Try using Rowv = FALSE, Colv = FALSE instead of NULL. Also, add 
dendrogram = none.


Best,

Jim




But the above command doesnt generate the heatmap. So could anyone let me know what 
are the options to avoid reordering the rows and columns of the heatmap and i dont 
want the dendogram. I am using the R version 2.8.0 (2008-10-20).

Thanks,
Tanuja




  
	[[alternative HTML version deleted]]






__
R-help@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.


--
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

__
R-help@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.


Re: [R] heatmap.2 no reordering of the columns and rows

2009-04-07 Thread Tanuja Bompada
Thanks James. That worked.

Tanuja

--- On Tue, 4/7/09, James W. MacDonald jmac...@med.umich.edu wrote:

From: James W. MacDonald jmac...@med.umich.edu
Subject: Re: [R] heatmap.2 no reordering of the columns and rows
To: Tanuja Bompada tanujabomp...@yahoo.com
Cc: r-help@r-project.org
Date: Tuesday, April 7, 2009, 8:02 AM

Hi Tanuja,

Tanuja Bompada wrote:
 Hi,
   I need to generate a heatmap on a square matrix and wouldn't want to 
reorder the columns and the rows on the heatmap display.    I have used the 
options Rowv=NULL and Colv=NULL but doesn't seem to work. Following is a 
snippet of the heatmap function i am using.
 
 args - commandArgs();
 inputfile - args[2]
 imgfile   - args[3]
 
 bitmap(imgfile, height=15, width=15, res=100, pointsize=9)
 
 library(gplots)
 library(RColorBrewer)
 data - read.table(inputfile)
 matrix - as.matrix(data)
 cp - colorRampPalette(c(red,yellow,darkgreen),space=Lab, bias=1.5)
 heatmap.2(matrix, Colv=1:ncol(matrix), dendogram=row, hclustfun=function(m) 
 hclust(m,method=complete),col=cp(25),scale=none,trace=none,keysize=1,margins=c(5,12),
  cexCol=1, cexRow=1)
 q()
 dev.off()
 
 The alternative that i tried to avoid the reordering was 
 heatmap.2(matrix, Rowv=NULL, Colv=NULL, col=cp(25), scale=none, 
 trace=none, keysize=1, margins=c(5,12), cexCol=1, cexRow=1)

Try using Rowv = FALSE, Colv = FALSE instead of NULL. Also, add dendrogram = 
none.

Best,

Jim


 
 But the above command doesnt generate the heatmap. So could anyone let me 
 know what are the options to avoid reordering the rows and columns of the 
 heatmap and i dont want the dendogram. I am using the R version 2.8.0 
 (2008-10-20).
 
 Thanks,
 Tanuja
 
 
 
 
       [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@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.

-- 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



  
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] heatmap and colour key

2009-03-11 Thread Stephen J. Barr
Check out http://cran.r-project.org/web/packages/RColorBrewer/index.html

On Wed, Mar 11, 2009 at 10:41 PM, Daren Tan darenta...@gmail.com wrote:
 I would like to visualize my data via heatmap so that the value range
 c(-2,2) corresponds to greenred(75). However, heatmap uses the min and
 max from my dataset instead. How to solve this ?

 __
 R-help@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.




-- 
==
Stephen J. Barr
University of Washington
Dept. of Applied and Computational Math Sciences
Dept. of Economics
WEB: www.econsteve.com

__
R-help@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.


Re: [R] heatmap with levelplot

2009-01-26 Thread Antje
I played a little bit around and got the following solution which works for 
now, though it seems to be too complicated to me.

If anybody else know another solution - please let me know!!!


library(lattice)
my.mat - matrix(rnorm(800), nrow = 40)

colorFun - colorRampPalette(c(yellow,red))

b - boxplot(my.mat, plot = FALSE)
thr - c(b$stats[1],b$stats[5])
col.bins - 100
step - abs(thr[2] - thr[1])/50

limit - ifelse(min(my.mat)  thr[1] - step, min(my.mat) - step, min(my.mat))
lp - rev(seq(thr[1] - step, limit - step, -step))
mp - seq(thr[1], thr[2], step)
limit - ifelse(max(my.mat)  thr[2] + step, max(my.mat) + step, max(my.mat))
up - seq(thr[2] + step, limit + step, step)

my.at - c(lp,mp,up)

my.col.regions - c(rep(green, length(lp)), colorFun(length(mp)), rep(blue, 
length(up)) )


levelplot(my.mat, at = my.at, col.regions = my.col.regions)






Antje schrieb:

Hi there,

I'd like to create a heatmap from my matrix with
a) a defined color range (lets say from yellow to red)
b) using striking colors above and below a certain threshold (above = 
green, below = blue)


Example matrix (there should be a few outliers generated...) + simple 
levelplot without outliers marked:


library(lattice)
my.mat - matrix(rnorm(800), nrow = 40)
threshold - c(-1,1) # should be used for the extreme colors
colorFun - colorRampPalette(c(yellow,red))
levelplot(my.mat, col.regions = colorFun(50))


I don't know how to handle the extrem values...

Can anybody help?

Antje

__
R-help@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.



__
R-help@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.


Re: [R] heatmap.2 color issue

2009-01-21 Thread Matthias Kohl

the heatmapCol function of package MKmisc might help ... try:
library(MKmisc)
example(heatmapCol)

Best
Matthias

Liu, Hao [CNTUS] wrote:

Dear All:

I tried to use heatmap.2 to generate hierarchical clustering using the 
following command:

heatmap.2(datamatrix, scale=row, trace=none, col=greenred(256), 
labRow=genelist[,1], margins=c(10,10), Rowv=TRUE, Colv=TRUE)

datamatrix is subset of a RMA normalized data subset by a genelist. 


The problem is a lot of times, the z-score in key are from, like -5 to 15 or 
-15 to 5, as a result, the zero of z distribution are are either green region 
or red region of
the key, the resulting heatmap are either generally greenish or redish.

I wonder if there is a way to make the heatmap more balanced between red and 
green, I tried to read the heatmap.2 help but could not get a clear idea.

Thanks
Hao


[[alternative HTML version deleted]]

__
R-help@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.
  


--
Dr. Matthias Kohl
www.stamats.de

__
R-help@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.


Re: [R] heatmap.2 and three colours for specific ran gesþ

2009-01-07 Thread YH Deng
a-matrix(rnorm(36,1,3),6,6)
ifelse(a(-1),1,ifelse(a=1a=-1,2,3))
heatmap.2(a, col=rev(redgreen(3)))

HTH

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Daren Tan
Sent: January 6, 2009 11:53 PM
To: r-help@r-project.org
Subject: [R] heatmap.2 and three colours for specific rangesþ

Hi,

I hope to show a heatmap with thre colours, no gradation. How to specify
heatmap.2 to map green for values less than -1, gray for values between
-1 and 1, and red for values greater than 1 ?

Thanks

[[alternative HTML version deleted]]

__
R-help@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.

__
R-help@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.


Re: [R] heatmap

2008-07-02 Thread Nair, Murlidharan T
I tried the following myself and I almost have something to work with. But I 
still need a little input.

#Plots a filled contour
# Can someone help me in increasing the resolution as my data range is 0-11? 
Also I need to put the row and column names on the axes.
x - 1:nrow(data)
y - 1:ncol(data[,-1])
filled.contour(x, y, as.matrix(data[,-1]), color = terrain.colors,
plot.title = title(main = , xlab = , ylab = ),
key.title = title(main=Hex count),
key.axes = axis(4,asp=1))# maybe also asp=1


#Plots the image directly.
#Can I specify specific set of colors in for the image to correspond to a 
particular value in the data matrix?
#I need to put the row and column names on the axes and make a key . Any help 
here please ?

image(x,y,as.matrix(data[,-1]),col=topo.colors(12)))


Thanks ../Murli





From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Nair, Murlidharan T 
[EMAIL PROTECTED]
Sent: Wednesday, July 02, 2008 2:02 PM
To: r-help@r-project.org
Subject: [R] heatmap

I am interested in plotting a matrix of data using heatmap to reflect frequency 
of  positional occurrence of certain strings. I am not interested in clustering 
them.  I also want to make a key for the colors.Can someone help me with that.
I am appending a portion of my data here.
Thanks ../Murli

data-dput(unique.data[1:20,1:20])
structure(list(A1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), A2 = c(0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
), A3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L,
0L, 0L, 0L, 0L, 0L, 0L, 0L), A4 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), A5 = c(0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L), A6 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), A7 = c(0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
A8 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L), A9 = c(0L, 0L, 0L, 0L, 0L, 1L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
A10 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L), A11 = c(0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
), A12 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), A13 = c(0L, 0L, 0L, 0L,
0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L), A14 = c(0L, 0L, 2L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), A15 = c(0L, 0L, 1L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L,
0L, 0L), A16 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L), A17 = c(0L, 0L,
0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L), A18 = c(0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), A19 = c(0L,
0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L), A20 = c(0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L,
0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c(A1,
A2, A3, A4, A5, A6, A7, A8, A9, A10, A11,
A12, A13, A14, A15, A16, A17, A18, A19, A20
), row.names = c(gg, gttagg, gggtgg, ggtagg, aggtag,
tg, gtttag, ggttag, gt, agttag, tttagg, ag,
tg, ggtggg, gtaggt, aggttt, taggtt, agtttg, agttcg,
taggta), class = data.frame)

heatmap(as.matrix(data))

__
R-help@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.

__
R-help@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.


Re: [R] heatmap and continuous variable

2008-06-25 Thread Hans-Ulrich Klein

Gregory Warnes wrote:

Hello Hans,

Do you need *both* a categorical *and* a continuous variable, or just a
continuous variable?

-Greg
  

Hello Greg,

I want to visualize survival data above the columns. So my continuous 
variable is follow up time and my categorical variable indicates the 
event. As the event has only two states (death or alive), one probably 
can omit an extra side bar for this variable and represent it by 
different colors within the plot for the follow up time. If it is easier 
to place two annotations above the heat map, that would be fine, too.


Probably the simplest solution is: Just plot numbers (follow up times) 
in red (death) or blue(alive) above the columns. (Analogous to the 
sample names under the columns.) I do not know how to do this.


Regards,
Hans-Ulrich


On 6/24/08 4:51PM , Hans-Ulrich Klein [EMAIL PROTECTED] wrote:

  

Dear All,

I want to plot a heat map with annotated columns. Both functions heatmap
(stats) and heatmap.2 (gplots) can plot a horizontal side bar that can
be used to visualize a categorical variable. In addition to a
categorical variable, I would like to visualize a continuous variable.
This could be done by small bars, a curve or simply numbers above the
columns. (The Sample names are already located at the bottom.)

Does someone have example code for this or a similar problem? Is this so
special that I have to get down to the lattice package?

Thank you,
Hans-Ulrich



  



--
Hans-Ulrich Klein
Department of Medical Informatics and Biomathematics
Westfälische Wilhelms-Universität Münster
Tel.: +49 (0)251 83-58405

__
R-help@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.


  1   2   >