Hello
I want to draw a plot using the code below.
Further, I want to add labels (White, Yellow, Red) to x-axis.
Please kindly advise how to add the categorical labels, by modifying the
code.
Thank you.
Elaine
Code
dataN <-read.csv("H:/skin_color.csv",header=T, row.names=1)
dim(dataN)
dataN[1,]
str(dataN)
obs.group<-dataN$skin_color
levels(dataN$skin_color) <- skin.code
skin.code <- c("White", "Yellow", "Red")
# graph
par(mai=c(1.03,1.03,0.4,0.4))
par(new=T)
plot(dataN$skin_color, dataN$body_length,
xlab="Skin Color",
ylab="Body Lenght",
xaxt="n",
type="p",
pch=1,lwd=2.0,
cex.lab=1.4, cex.axis=1.2,
font.axis=2,
cex=1.5,
las=1,
bty="l",
col=c("gray38","orange","red2")[obs.group])
[[alternative HTML version deleted]]