## I would do this in lattice using the panel.bwplot.intermediate.hh
## function from the HH package.

## install.packages("HH") ## if necessary
library(HH)

dataN <- data.frame(GE_distance=rnorm(260),
                    Diet_B=factor(rep(1:13, each=20)))
Diet.colors <- c("forestgreen", "darkgreen","chocolate1","darkorange2",
                 "sienna2","red2","firebrick3","saddlebrown","coral4",
                 "chocolate4","darkblue","navy","grey38")
bwplot(GE_distance ~ Diet_B, data=dataN,
       xlab=list("Diet of Breeding Ground", cex = 1.4),
       ylab = list(
         "Distance between Centers of B and NB Range (1000 km)",
         cex = 1.4),
       panel=panel.bwplot.intermediate.hh,
       col=Diet.colors,
       pch=rep("|",13))


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)
>
>         [[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]]

______________________________________________
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