Hi all, I have 6 datasets(dataframes Assem_ContigsLen7 through all_ContigsLen12) containing 3 columns (contig_id, contig_length, read_count). Each dataset is composed of 3 types of contigs (assemblies of genomic fragments), 1- all Bacterial fragments, 2 - all Viral fragments, 3 - mixed fragments. I identified the type of contig through a merge with another table with just contig_id and contig_type as below: AssemViral_ContigsLen<-merge(Assem_ContigsLen,allViral_contigs,by.x="contig_id",by.y="X.Contid.ID",all.x=FALSE) Below is a boxplot for boxplot(Assem_ContigsLen7$length,Assem_ContigsLen8$length,Assem_ContigsLen9$length,Assem_ContigsLen10$length,Assem_ContigsLen11$length,Assem_ContigsLen12$length,main="100species_rep2",ylab="Contig_length") All of the longer contigs in the sixth data set are allViral. How can I colour or label these? I tried overlaying 2 boxplots of different colours (using add=TRUE), but the individual points of the whiskers aren't coloured (and I can't figure out how to do so) I experimented with using points, but there isn't a general function that I can apply to all 6 datasets to identify the allViral contigs. specific questions; 1 -how can I color the data points that represent the whiskers in a boxplot? 2 - Can I identify and colour subsets of datapoints within a boxplot? 3- any other suggestions? Thank you, Alison
It would really help if you could reduce the information below to a small reproducible example, that is, some small bit of code that a reader can paste into R and poke around at. For sending a small sample dataset have a look at ?dput I believe that this problem has been discussed on the R-help list before and you might find something about it with a search (RSiteSearch()) or using Google but it is hard to tell without an example. --- On Thu, 8/5/10, alison waller <alison.waller at embl.de> wrote:> From: alison waller <alison.waller at embl.de> > Subject: [R] colour of label points on a boxplot > To: r-help at r-project.org > Received: Thursday, August 5, 2010, 7:36 AM > Hi all, > > I have 6 datasets(dataframes Assem_ContigsLen7 through > all_ContigsLen12) > containing 3 columns (contig_id, contig_length, > read_count). > > Each dataset is composed of 3 types of contigs (assemblies > of genomic > fragments), 1- all Bacterial fragments, 2 - all Viral > fragments, 3 - > mixed fragments. > > I identified the type of contig through a merge with > another table with > just contig_id and contig_type as below: > > AssemViral_ContigsLen<-merge(Assem_ContigsLen,allViral_contigs,by.x="contig_id",by.y="X.Contid.ID",all.x=FALSE) > > Below is a boxplot for > > boxplot(Assem_ContigsLen7$length,Assem_ContigsLen8$length,Assem_ContigsLen9$length,Assem_ContigsLen10$length,Assem_ContigsLen11$length,Assem_ContigsLen12$length,main="100species_rep2",ylab="Contig_length") > > > All of the longer contigs in the sixth data set are > allViral. > > How can I colour or label these? > I tried overlaying 2 boxplots of different colours (using > add=TRUE), but > the individual points of the whiskers aren't coloured (and > I can't > figure out how to do so) > I experimented with using points, but there isn't a general > function > that I can apply to all 6 datasets to identify the allViral > contigs. > > specific questions; > 1 -how can I color the data points that represent the > whiskers in a boxplot? > 2 - Can I identify and colour subsets of datapoints within > a boxplot? > 3- any other suggestions? > > Thank you, > > Alison > > > > ______________________________________________ > 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. >
Alison, Check out the options for the function bxp(), they include control over the colors of all parts of the boxplot, e.g., whiskcol for whisker color. Jean `·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º> Jean V. Adams Statistician U.S. Geological Survey Great Lakes Science Center 223 East Steinfest Road Antigo, WI 54409 USA phone: 715-623-4190, ext. 3125 FAX: 715-623-6773 GLSC web site: http://www.glsc.usgs.gov My homepage: http://profile.usgs.gov/jvadams e-mail: jvadams@usgs.gov -------------------------------------------------------------------------------- Thu Aug 5 13:36:05 CEST 2010 Hi all, I have 6 datasets(dataframes Assem_ContigsLen7 through all_ContigsLen12) containing 3 columns (contig_id, contig_length, read_count). Each dataset is composed of 3 types of contigs (assemblies of genomic fragments), 1- all Bacterial fragments, 2 - all Viral fragments, 3 - mixed fragments. I identified the type of contig through a merge with another table with just contig_id and contig_type as below: AssemViral_ContigsLen<-merge(Assem_ContigsLen,allViral_contigs,by.x="contig_id",by.y="X.Contid.ID",all.x=FALSE) Below is a boxplot for boxplot(Assem_ContigsLen7$length,Assem_ContigsLen8$length,Assem_ContigsLen9$length,Assem_ContigsLen10$length,Assem_ContigsLen11$length,Assem_ContigsLen12$length,main="100species_rep2",ylab="Contig_length") All of the longer contigs in the sixth data set are allViral. How can I colour or label these? I tried overlaying 2 boxplots of different colours (using add=TRUE), but the individual points of the whiskers aren't coloured (and I can't figure out how to do so) I experimented with using points, but there isn't a general function that I can apply to all 6 datasets to identify the allViral contigs. specific questions; 1 -how can I color the data points that represent the whiskers in a boxplot? 2 - Can I identify and colour subsets of datapoints within a boxplot? 3- any other suggestions? Thank you, Alison [[alternative HTML version deleted]]