[R] plot: x and y chromosomes are missing

S Ellison S.Ellison at LGCGroup.com
Tue Sep 11 11:43:58 CEST 2012


 

> -----Original Message-----
> I have a list with gene names, fold changes (=expression 
> level) and chromosomes.
> 
> Names   fold change  chromosome
> hz          1.5              2
> 
> 
> If I plot fold change versus chromosome (or vice versa):
> 
> plot (ch, fc)
> 
> I see only the chromosomes with numbers but not those with 
> letter (x and y). What can I do?

Make sure your chromosome column is a factor or character vector. 
>From your description so far, I deduce that it is numeric (you can check by saying class(chromosome) ). I am guessing that R has been told to convert chromosome to numeric. If so, R would convert X and Y to NA (that is, missing) in the process - with a warning that ought to have been obvious - because they are not numbers. That would explain why you aren't seeing them in the plot.
How you got that I don't know; the default would be to import as factor.

Anyway, once you have chromosome properly imported as character or factor you can use barplot with chromosome used as labels, or plot(1:length(fc), axes=FALSE) and then add axes using 
axis(1, at=1:length(fc)), labels=chromosome) #or similar
and
axis(2)


> How can I add a single line in that plot at a certain y-level.
see ?abline

> 
> Thanks
> Hermann
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}




More information about the R-help mailing list