Hi, I have a data set of 47 columns. I would like to create a boxplot for each column, each boxplot of a different colour. So I created a vector "col1". This vector has a subset of the colors returned by color()- "red", "cyan", "green" etc. Now I use the command: boxplot(dataset, col= col1) expecting to see 47 boxplots, each of a different colour. Here is the problem: the boxplots are drawn correctly but it seems that only the first few colours in col1 are being used in a repeated pattern. Anybody has any ideas on how to tackle this? Thanks in advance, Anjan -- ==================================anjan purkayastha, phd. research associate fas center for systems biology, harvard university 52 oxford street cambridge ma 02138 phone-703.740.6939 ================================== [[alternative HTML version deleted]]
Anjan - I think you'll need to give us more information -- I can't reproduce the problem. For example,> dat = data.frame(matrix(rnorm(47000),100,47)) > cols = sample(colors(),47) > boxplot(dat,col=cols)doesn't repeat any of the colors in cols. - Phil On Thu, 7 Oct 2010, ANJAN PURKAYASTHA wrote:> Hi, > I have a data set of 47 columns. I would like to create a boxplot for each > column, each boxplot of a different colour. > So I created a vector "col1". This vector has a subset of the colors > returned by color()- "red", "cyan", "green" etc. > Now I use the command: boxplot(dataset, col= col1) expecting to see 47 > boxplots, each of a different colour. > Here is the problem: the boxplots are drawn correctly but it seems that only > the first few colours in col1 are being used in a repeated pattern. > Anybody has any ideas on how to tackle this? > Thanks in advance, > Anjan > > -- > ==================================> anjan purkayastha, phd. > research associate > fas center for systems biology, > harvard university > 52 oxford street > cambridge ma 02138 > phone-703.740.6939 > ==================================> > [[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. >
I would be helpful if you provided a more complete, reproducible example. Consider the following code. It colors the boxes according to the first 47 colors listed in the color() vector. -tgs data<-as.data.frame(matrix(rnorm(47*23),ncol=47)) boxplot(data,col=colors()[1:47]) On Thu, Oct 7, 2010 at 2:22 PM, ANJAN PURKAYASTHA < anjan.purkayastha@gmail.com> wrote:> Hi, > I have a data set of 47 columns. I would like to create a boxplot for each > column, each boxplot of a different colour. > So I created a vector "col1". This vector has a subset of the colors > returned by color()- "red", "cyan", "green" etc. > Now I use the command: boxplot(dataset, col= col1) expecting to see 47 > boxplots, each of a different colour. > Here is the problem: the boxplots are drawn correctly but it seems that > only > the first few colours in col1 are being used in a repeated pattern. > Anybody has any ideas on how to tackle this? > Thanks in advance, > Anjan > > -- > ==================================> anjan purkayastha, phd. > research associate > fas center for systems biology, > harvard university > 52 oxford street > cambridge ma 02138 > phone-703.740.6939 > ==================================> > [[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]]