Skip to content

scatterplot with wrong line offset

2 messages · fm3c2007, John Fox

#
Hi All,

I'm trying to do a Scatterplot (package: car), and add a line (just for
reference).

There is my code:
#------------------------------------Code---------------------------------------------------
library("car")
library("calibrate")
G_T<-c("car","bike","boat")
ave<-c(80,10,45)
perf<-c(100,80,75)
df2<-data.frame(G_T,ave,perf)

scatterplot(ave ~ perf, data=df2,smoother=FALSE,xlim=c(0,100),ylim=c(0,100))                                                                  
textxy(df2$perf,df2$ave, df2$G_T)

#The wrong offset begin here.
grid()
lines(x=c(0,40),y=c(20,20),type="l")
#---------------------------------------------------------Code
end---------------------------------------------

Here is the plot:
<http://r.789695.n4.nabble.com/file/n4647202/Offset_Scatterplot.png> 

My problem is that the line should start at (0,20) and end at (40,20) , and
it has a offset...
What should i do? 

Thanks
Francisco



--
View this message in context: http://r.789695.n4.nabble.com/scatterplot-with-wrong-line-offset-tp4647202.html
Sent from the R help mailing list archive at Nabble.com.
#
Dear Francisco,
"reset.par: 	if TRUE then plotting parameters are reset to their previous values when scatterplot exits; if FALSE then the mar and mfcol parameters are altered for the current plotting device. Set to FALSE if you want to add graphical elements (such as lines) to the plot."

Best,
 John

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
	
On Tue, 23 Oct 2012 12:00:11 -0700 (PDT)
fm3c2007 <fm3c2007 at gmail.com> wrote: