Point plot against labels and reordering
2
0
Entering edit mode
Daniel Brewer ★ 1.9k
@daniel-brewer-1791
Last seen 9.7 years ago
Hi, I am getting really frustrated with trying to create a specific plot. I have the following matrix (monkey): Exon PRC1 PRC2 PRC3 1 0_110 2.0132845 1.484080 1.923869 2 0_34 2.6528139 1.141114 1.242584 3 0_78 1.6247146 1.230726 1.592407 4 10 1.4471323 1.137777 1.426656 5 11 1.5471201 1.204736 1.500566 6 2 1.0423570 1.104883 1.087180 7 3 0.9563367 1.017354 1.067159 8 4 1.4577586 1.166938 1.422878 9 5 1.5081813 1.177205 1.494983 10 6 1.4432391 1.144851 1.396613 11 7 1.6995243 1.337146 1.643418 12 8 1.3848549 1.096389 1.357165 13 9 1.4995867 1.162944 1.444809 Exon is the Exon number of a label saying which two exons the probe is in-between. That column should be treated as labels, not numeric. What I would like to be able to do is plot for example PRC1 on the y-axis and the Exon as the x-axis labels (just evenly spaced not a numeric scale). Secondly I would like to be able to reorder the labels for the plot. The closest I have got is: plot(monkey$Exon,monkey$PRC1) But that seems to be producing a boxplot rather than points. If I put type="p" it makes no difference and if I try and reorder the matrix it does not make any difference either e.g. monkey$Exon[c(6,7,2,8,9,10,11,3,12,13,4,5,1)] monkey$Exon is a factor object Any help would be great. Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Email: daniel.brewer at 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 addre...{{dropped}}
Cancer probe Cancer probe • 912 views
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 4 months ago
United States
On Wednesday 18 April 2007 10:25, Daniel Brewer wrote: > Hi, > > I am getting really frustrated with trying to create a specific plot. I > have the following matrix (monkey): > Exon PRC1 PRC2 PRC3 > 1 0_110 2.0132845 1.484080 1.923869 > 2 0_34 2.6528139 1.141114 1.242584 > 3 0_78 1.6247146 1.230726 1.592407 > 4 10 1.4471323 1.137777 1.426656 > 5 11 1.5471201 1.204736 1.500566 > 6 2 1.0423570 1.104883 1.087180 > 7 3 0.9563367 1.017354 1.067159 > 8 4 1.4577586 1.166938 1.422878 > 9 5 1.5081813 1.177205 1.494983 > 10 6 1.4432391 1.144851 1.396613 > 11 7 1.6995243 1.337146 1.643418 > 12 8 1.3848549 1.096389 1.357165 > 13 9 1.4995867 1.162944 1.444809 > > Exon is the Exon number of a label saying which two exons the probe is > in-between. That column should be treated as labels, not numeric. > > What I would like to be able to do is plot for example PRC1 on the > y-axis and the Exon as the x-axis labels (just evenly spaced not a > numeric scale). Secondly I would like to be able to reorder the labels > for the plot. > > The closest I have got is: > plot(monkey$Exon,monkey$PRC1) How about (untested): matplot(monkey[,2:4],axes=F) axis(side=1,labels=as.character(monkey$Exon)) box() Or, if you want only PRC1: plot(monkey[,2],axes=F) instead of matplot. Sean
ADD COMMENT
0
Entering edit mode
even better, there is a very good book on how to do graphics in R, called R Graphics, by Paul Murrell, you really should buy it... Sean Davis wrote: > On Wednesday 18 April 2007 10:25, Daniel Brewer wrote: >> Hi, >> >> I am getting really frustrated with trying to create a specific plot. I >> have the following matrix (monkey): >> Exon PRC1 PRC2 PRC3 >> 1 0_110 2.0132845 1.484080 1.923869 >> 2 0_34 2.6528139 1.141114 1.242584 >> 3 0_78 1.6247146 1.230726 1.592407 >> 4 10 1.4471323 1.137777 1.426656 >> 5 11 1.5471201 1.204736 1.500566 >> 6 2 1.0423570 1.104883 1.087180 >> 7 3 0.9563367 1.017354 1.067159 >> 8 4 1.4577586 1.166938 1.422878 >> 9 5 1.5081813 1.177205 1.494983 >> 10 6 1.4432391 1.144851 1.396613 >> 11 7 1.6995243 1.337146 1.643418 >> 12 8 1.3848549 1.096389 1.357165 >> 13 9 1.4995867 1.162944 1.444809 >> >> Exon is the Exon number of a label saying which two exons the probe is >> in-between. That column should be treated as labels, not numeric. >> >> What I would like to be able to do is plot for example PRC1 on the >> y-axis and the Exon as the x-axis labels (just evenly spaced not a >> numeric scale). Secondly I would like to be able to reorder the labels >> for the plot. >> >> The closest I have got is: >> plot(monkey$Exon,monkey$PRC1) > > How about (untested): > > matplot(monkey[,2:4],axes=F) > axis(side=1,labels=as.character(monkey$Exon)) > box() > > Or, if you want only PRC1: > > plot(monkey[,2],axes=F) > > instead of matplot. > > Sean > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 rgentlem at fhcrc.org
ADD REPLY
0
Entering edit mode
On Wednesday 18 April 2007 12:23, Robert Gentleman wrote: > even better, there is a very good book on how to do graphics in R, > called R Graphics, by Paul Murrell, you really should buy it... Very good point.... Sean
ADD REPLY
0
Entering edit mode
On Wednesday 18 April 2007 10:39, Sean Davis wrote: > On Wednesday 18 April 2007 10:25, Daniel Brewer wrote: > > What I would like to be able to do is plot for example PRC1 on the > > y-axis and the Exon as the x-axis labels (just evenly spaced not a > > numeric scale). Secondly I would like to be able to reorder the labels > > for the plot. I forgot to address your reordering problem. Simply reorder the monkey data frame however you like and the plotting code I just sent should work just fine. (Again, untested....) Sean
ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States
Hi Dan, Daniel Brewer wrote: > Hi, > > I am getting really frustrated with trying to create a specific plot. I > have the following matrix (monkey): > Exon PRC1 PRC2 PRC3 > 1 0_110 2.0132845 1.484080 1.923869 > 2 0_34 2.6528139 1.141114 1.242584 > 3 0_78 1.6247146 1.230726 1.592407 > 4 10 1.4471323 1.137777 1.426656 > 5 11 1.5471201 1.204736 1.500566 > 6 2 1.0423570 1.104883 1.087180 > 7 3 0.9563367 1.017354 1.067159 > 8 4 1.4577586 1.166938 1.422878 > 9 5 1.5081813 1.177205 1.494983 > 10 6 1.4432391 1.144851 1.396613 > 11 7 1.6995243 1.337146 1.643418 > 12 8 1.3848549 1.096389 1.357165 > 13 9 1.4995867 1.162944 1.444809 > > Exon is the Exon number of a label saying which two exons the probe is > in-between. That column should be treated as labels, not numeric. > > What I would like to be able to do is plot for example PRC1 on the > y-axis and the Exon as the x-axis labels (just evenly spaced not a > numeric scale). Secondly I would like to be able to reorder the labels > for the plot. > > The closest I have got is: > plot(monkey$Exon,monkey$PRC1) Does plot(1:dim(monkey)[1], monkey$PRC1, xaxt="n") axis(1, at=1:dim(monkey)[1], labels = monkey$Exon, las=2) do what you want? Best, Jim > > But that seems to be producing a boxplot rather than points. If I put > type="p" it makes no difference and if I try and reorder the matrix it > does not make any difference either e.g. > monkey$Exon[c(6,7,2,8,9,10,11,3,12,13,4,5,1)] > > monkey$Exon is a factor object > > Any help would be great. > > Dan > -- James W. MacDonald, M.S. Biostatistician Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
ADD COMMENT
0
Entering edit mode
Thanks James and Sean, using a combination of the two that worked great. > matplot(monkey[c(6,7,2,8,9,10,11,3,12,13,4,5,1),2:4], xaxt="n") > axis(side=1,at=1:nrow(monkey),labels=as.character(monkey$Exon[c(6,7,2, 8,9,10,11,3,12,13,4,5,1)]),las=2) Excellant. Dan James W. MacDonald wrote: > Hi Dan, > > Daniel Brewer wrote: >> Hi, >> >> I am getting really frustrated with trying to create a specific plot. I >> have the following matrix (monkey): >> Exon PRC1 PRC2 PRC3 >> 1 0_110 2.0132845 1.484080 1.923869 >> 2 0_34 2.6528139 1.141114 1.242584 >> 3 0_78 1.6247146 1.230726 1.592407 >> 4 10 1.4471323 1.137777 1.426656 >> 5 11 1.5471201 1.204736 1.500566 >> 6 2 1.0423570 1.104883 1.087180 >> 7 3 0.9563367 1.017354 1.067159 >> 8 4 1.4577586 1.166938 1.422878 >> 9 5 1.5081813 1.177205 1.494983 >> 10 6 1.4432391 1.144851 1.396613 >> 11 7 1.6995243 1.337146 1.643418 >> 12 8 1.3848549 1.096389 1.357165 >> 13 9 1.4995867 1.162944 1.444809 >> >> Exon is the Exon number of a label saying which two exons the probe is >> in-between. That column should be treated as labels, not numeric. >> >> What I would like to be able to do is plot for example PRC1 on the >> y-axis and the Exon as the x-axis labels (just evenly spaced not a >> numeric scale). Secondly I would like to be able to reorder the labels >> for the plot. >> >> The closest I have got is: >> plot(monkey$Exon,monkey$PRC1) > > Does > > plot(1:dim(monkey)[1], monkey$PRC1, xaxt="n") > axis(1, at=1:dim(monkey)[1], labels = monkey$Exon, las=2) > > do what you want? > > Best, > > Jim > > >> >> But that seems to be producing a boxplot rather than points. If I put >> type="p" it makes no difference and if I try and reorder the matrix it >> does not make any difference either e.g. >> monkey$Exon[c(6,7,2,8,9,10,11,3,12,13,4,5,1)] >> >> monkey$Exon is a factor object >> >> Any help would be great. >> >> Dan >> > > -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Email: daniel.brewer at 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 addre...{{dropped}}
ADD REPLY

Login before adding your answer.

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

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

Powered by the version 2.3.6