Dear R-listers,
There is my data and my codes to create a plot. I want to know why
there are two small circles in the upper right and lower left of the
plot respectively. Could you please share your experience or advice
with me?
# dummy data
factor<-rep(c("Alice","Jone","Mike"),each=100)
factor<-factor(factor)
traits<-c(rnorm(100, mean=1, sd=1), rnorm(100, mean=3, sd=3),
rnorm(100, mean=6, sd=6))
myda<-data.frame(factor,traits)
# my plot
plot(c(min(myda$traits),max(myda$traits)),c(-0.03,0.5), xlab='State',
ylab='ylab')
lines(density(myda$traits[factor==c("Alice")]), lwd=2,col=2)
lines(density(myda$traits[factor==c("Jone")]), lwd=2,col=3)
lines(density(myda$traits[factor==c("Mike")]), lwd=2,col=4)
points(myda$traits[factor==c("Alice")], rep(-0.01,
length(myda$traits[factor==c("Alice")])), pch="|", col=2)
points(myda$traits[factor==c("Jone")], rep(-0.02,
length(myda$traits[factor==c("Jone")])), pch="|", col=3)
points(myda$traits[factor==c("Mike")], rep(-0.03,
length(myda$traits[factor==c("Mike")])), pch="|", col=4)
Best Regards,
Yours,
Mao J-F
Hi, Mao Jianfeng schrieb:> plot(c(min(myda$traits),max(myda$traits)),c(-0.03,0.5), xlab='State', > ylab='ylab')Here, you are plotting two data points: (min(myda$traits),-0.03) and (max(myda$traits),0.5). Try this: > plot(c(min(myda$traits),max(myda$traits)),c(-0.03,0.5), xlab='State', > ylab='ylab',type='n') HTH, Stephan
>>> Mao Jianfeng <jianfeng.mao at gmail.com> 19/08/2009 08:10:54 >>> >There is my data and my codes to create a plot. I want to know why >there are two small circles in the upper right and lower left of the >plot respectively.Because your first plot() command put them there. add type="n" to the first plot command? ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}
Seemingly Similar Threads
- how to fill the area under the density line with semitransparent colors
- how to substitute missing values (NAs) by the group means
- how to add 95% confidential interval as vertical lines to x axe in density plot
- how to calculate the consistency of different clusterings
- how to use "lapplyBy" function of "doBy" package