Hi,
I am trying to create a scatterplot, coding each point to one of 5
populations. I was successful when I did this for one set of data, yet
when I try plotting other data a blank plot appears (although the axes are
labelled and I can fit the regression lines from each population). I have
tried a variety of things to fix this but nothing seems to work.
I can plot the points if I do not specify that I want each population to
have a particular symbol. However, once I add the command [grip$Morph] to
my symbol parameter (e.g., pch=c(2,6,5,19,15) [grip$morph] ), I loose all
the points. As I mentioned above, I was able to create a plot
successfully using other data points from the same table (different
columns), so I know the data are fine.
Has anyone come across this before?
R-script used:
----------------------------------------
HAND<-AllMal[,c(2,4,5)]
na.omit(HAND)->HAND
write.csv(HAND, "grip.csv")
read.csv("grip.csv")->grip
grip
class(grip)
class(HAND)
grip$morph<-as.character(grip$Morph)
morph<- grip$morph
BML<-grip$BML
grip$MCF->MCF
reg1<-lm(BML~MCF,data=subset(grip,morph=="mel"));reg1
reg2<-lm(BML~MCF,data=subset(grip,morph=="tham"));reg2
reg3<-lm(BML~MCF,data=subset(grip,morph=="A"));reg3
reg4<-lm(BML~MCF,data=subset(grip,morph=="B"));reg4
reg5<-lm(BML~MCF,data=subset(grip,morph=="C"));reg5
plot(MCF,BML,pch=c(2,6,5,19,15)[grip$morph],xlab="Residual Metacarpal
Length",ylab="Residual Hand Strength (Broad Dowel)",
main="Males")
abline(reg1,lty=1)
abline(reg2,lty=2)
abline(reg3,lty=3)
abline(reg4,lty=4)
abline(reg5,lty=6)
--
*Jessica da Silva*
PhD Candidate
Molecular Ecology & Evolution Program
Applied Biodiversity Research
Kirstenbosch Research Centre
South African National Biodiversity Institute
Postal address:
3 Sangster Road
Howick, KZN
3290
Home/Fax: +27 33 330 2230
Cell: +27 79 045 1781
Email: jessica.m.dasilva@gmail.com
j.dasilva@sanbi.org.za
Website: http://jmdasilva.doodlekit.com/home/home
[[alternative HTML version deleted]]