Hi,
Try:
mat <- 
as.matrix(read.csv("R.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t",row.names=1))
pdf("Hist_colwise.pdf")
lst1 <- lapply(seq_len(ncol(mat)),function(i) {x<- mat[,i,drop=FALSE]; hist(x, 
main=paste("Histogram of", colnames(x)))})
dev.off()

##or may be this would be another way to look at the data
library(reshape2)
library(ggplot2)
 dat <- melt(mat)


pdf("Hist_all.pdf", width=14)
ggplot(dat, aes(x=Var2, y=value, 
fill=Var1))+geom_histogram(stat="identity",position="dodge")+
 theme(legend.position = "none")+
 xlab("") +
 theme(axis.line = element_line(colour = "black"),
 panel.grid.major = element_blank(),
 panel.grid.minor = element_blank(),
 panel.border = element_blank(),
 panel.background = element_blank()) 
dev.off()



A.K.


On Thursday, May 22, 2014 10:48 AM, Effat Habibi <habibi...@gmail.com> wrote:



Thanks. I think columnwise histogram should be fine. Can you please help me 
with the commands for making that?
On May 22, 2014 2:21 AM, "arun" <smartpink...@yahoo.com> wrote:

Hi Effat,
>
>Sorry, I was a bit busy.  I did read the data. 
>
>
>mat <- 
>as.matrix(read.csv("R.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t",row.names=1))
> is.matrix(mat)
>#[1] TRUE
>
> head(mat,2)
>          COG0001H COG0002E COG0003P COG0004P COG0005F COG0006E COG0007H
>NC_014218       NA       NA       NA       NA      274      502       NA
>NC_013501      437      345       NA      458      284      364      271
>          COG0008J COG0009J COG0010E COG0011S COG0012J COG0013J COG0014E
>NC_014218      427      212       NA      103      365      890       NA
>NC_013501      500      317      316       NA      366      953       NA
>          COG0015F
>NC_014218      479
>NC_013501      431
>
>
>
>I am not sure I understand what you really wanted.  In the matrix example I 
>showed, I did the table for all the elements of the matrix.  Do you want a 
>columnwise histogram or a rowwise histogram??
>
>A.K.
>
>
>
>On Tuesday, May 20, 2014 1:29 PM, Effat Habibi <habibi...@gmail.com> wrote:
>
>
>
>Thanks, it works. But this histogram doesn't show any information about my 
>data,
>I want to make an informative histogram of my data which tells about length of 
>different COGs across 
>the genome. 
>
>
>
>
>

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

Reply via email to