# find top 4 points circ <- TOC_NI[order(TOC_NI$NI,decreasing=T),][1:4,]TOC_NI[order(TOC_NI$NI,decreasing=T),][1:4,]
# add them to your plot! plot(NI~TOC,data=TOC_NI,col="blue", pch=16, xlim=c(0,4500000)) abline(lm(NI~TOC,data=TOC_NI),col = "red",lwd=3) points(NI~TOC,data=TOC_NI,col='red',pch=1,size=3) Justin On Tue, Jan 10, 2012 at 7:11 AM, Geophagus <falk.hilli...@twain-systems.com>wrote: > Hi @ all, > I have question how to mark significant outliers in R. > This is my very simple script to plot a regression: > > TOC_NI<-read.csv2("C:/Users/XYZ/Desktop/Master/Daten/Statistik/TOC-NI.csv", > sep=";", dec=",", encoding="UTF-8") > plot(NI~TOC,data=TOC_NI,col="blue", pch=16, xlim=c(0,4500000)) > abline(lm(NI~TOC,data=TOC_NI),col = "red",lwd=3) > summary(lm(NI~TOC,data=TOC_NI)) > > The result is the following pic: > http://r.789695.n4.nabble.com/file/n4282207/nickel_TOC_5f.png > nickel_TOC_5f.png > > Now I want to make small red circles around the four highest values of Ni. > Does anyone has an idea how to do that? > Thanks a lot! > > Best Regards > Geophagus > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/colored-outliers-tp4282207p4282207.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.