Skip to content

(CAR) Scatterplot and problems (?) with abline

2 messages · Joel Kincaid, John Fox

#
Network Blitz
I'm trying to generate a graph to summarize Interest Rate Parity. This
involves a scatterplot of x against y where the x and y limits are set
so to center the graph on 0,0 and then adding each axis line and a 45
degree line. Using CAR's scatterplot (sample code below) everything
except the axes plot fine:

scatterplot( Interest.Rate.Dif ~ ForPrm| profit,
xlim=c(-1,1),ylim=c(-1,1))
abline(0,1)
abline(v=0)
abline(h=0).
The problem is that the vertical (horz) line lies aprox 3% below (to the
left) of the 'zero' tick (or perhaps the zero tick lies above the zero
point). My intution is that there are multiple coordnet systems, but who
knows....
Any insights, suggestions etc, are welcome,
cheers,
Joel Kincaid,
Asst. Prof of Economics,
Salisbury University,
Salisbury MD USA

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Dear Joel,

To draw marginal boxplots around the scatterplot, the scatterplot function 
in car sets some plotting parameters, then resets these to their previous 
value when the function exits, making it impossible to add to the plot. 
This behaviour is intentional, but I agree that it can be problematic.

An immediate fix is to comment out the command
   on.exit(par(mar = mar, mfcol = mfcol))
in scatterplot.default. If you do this, be aware that these plotting 
parameters will be changed for the current graphics device.

A more permanent solution is to add an argument such as reset.par 
(defaulting to FALSE) to the function, which I'll do in the next version of 
car.

Thanks for bringing the problem to my attention,
  John
At 01:26 PM 8/26/2002 -0400, Joel Kincaid wrote:
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._