Hello Sarah,

Thanks for the suggestion of
table(obs.group).

I checked it and found no problems of the obs.group.

As for using dput(),
please kindly share some examples to display the colored graph in r-help.
In fact, some colors were assigned to all types of diets, like
A=>red1
B=>red2
C=>green1
D=>green4
E=>darkgreen
F=>orange3
G=>darkorange2
H=>navy
I=>blue1

However, the boxplot displays as
A=>red1
B=>red2
C=>green1
D=>green4
E=>red1
F=>red2
G=>green1
H=>green4
I=>red1.

I am wondering if there is any bug in showing too many colors for boxplot.

Elaine


On Tue, Sep 25, 2012 at 6:52 AM, Sarah Goslee <sarah.gos...@gmail.com>wrote:

> Hi Elaine,
>
> Without a reproducible example it's impossible to say, but I'd take a
> hard look at:
> table(obs.group)
>
> If that doesn't give you some insight, a small reproducible example
> included in your email using dput() would allow us to answer you more
> effectively.
>
> Sarah
>
>
> On Mon, Sep 24, 2012 at 6:23 PM, Elaine Kuo <elaine.kuo...@gmail.com>
> wrote:
> > Hello,
> >
> > I am making a boxplot of 13 boxes.
> > I tried to color the box using 13 colors but failed.
> > Only red and brown were displayed.
> > Green, blue, and grey disappeared.
> >
> > Please kindly advise modification after checking the code below.
> > Thank you in advance.
> >
> > Elaine
> >
> > R code
> > # data input
> >     dataN
> >
> <-read.csv("H:/a_mig_distance_B_NB/R_data/Mig_bird_586_20120925.csv",header=T,
> > row.names=1)
> >     dim(dataN)
> >     dataN[1,]
> >     str(dataN)
> >
> >   # graph
> >     par(mai=c(1,1.03,0.4,0.4))
> >
> >     obs.group<-dataN$Diet_B
> >
> >     par(new=T)
> >
> >     boxplot(GE_distance~Diet_B, data=dataN,xlab="Diet  of  Breeding
> >  Ground",ylab="",
> >     yaxt="n",type="p",
> >     pch=1,lwd=0.95,
> >     cex.lab=1.4, cex.axis=1.2,
> >     font.axis=2,
> >     cex=1.5,
> >     las=1,
> >     bty="l",
> >     col=c("forestgreen",
> "darkgreen","chocolate1","darkorange2","sienna2",
> > "red2","firebrick3",
> >
> >
> "saddlebrown","coral4","chocolate4","darkblue","navy","grey38")[obs.group]))
> >
> >     op = par(mar = c(5,5,4,2) + 0.1)
> >     title(ylab = "Distance between Centers of B and NB Range (1000 km)",
> > cex.lab = 1.4,line = 3)
> >
> >     axis(side=2,yaxp=c(0,20000,4),cex.lab=1.4, cex.axis=1.2,font.axis=2,
> > las=1)
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>

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

Reply via email to