Skip to content

plot with the axes at xlim and ylim

6 messages · Arnold Kester, Brian Ripley, Ko-Kang Kevin Wang +1 more

#
I'd like to make a plot with the axes drawn at the values of xlim and
ylim. The default plot draws the axes slightly outside these values. I
have been experimenting with the par(mgp) setting, but specifying
par(mgp=c(2,0,-1)) gives me 

"invalid value specified for graphics parameter "mgp".".

A more complicated mathod that almost seems to work is doing the plot
with "axes=F" and then adding the axes with "axis" statements:

xlim <- c(0,10)
ylim <- c(0,11)
plot(c(1:9),c(1:9),axes=F,xlim=xlim,ylim=ylim)
axis(1,pos=ylim[1])
axis(2,pos=xlim[1])
axis(3,pos=ylim[2],labels=F)
axis(4,pos=xlim[2],labels=F)

The problem here is that the vertical axes are not long enough. 

Is there an easier way to get what I want?

Thanks,
Arnold Kester
#
On 19 Mar 2002, Arnold Kester wrote:

            
par(xaxs="i", yaxs="i")
#
Not quite sure what exactly you want, but it seems like:
    plot(c(1:9), c(1:9), xlim = xlim, ylim = ylim)
does the job - though I'm not sure why you specify ylim = c(0, 11) instead
of ylim = c(0,10).

Cheers,

Ko-Kang

------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
Auckland
New Zealand

----- Original Message -----
From: "Arnold Kester" <arnold.kester at stat.unimaas.nl>
To: "r-help" <r-help at stat.math.ethz.ch>
Sent: Tuesday, March 19, 2002 10:55 PM
Subject: [R] plot with the axes at xlim and ylim
-.-.-
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Thanks, excellent advice. I apologize for not reading the docs more
accurately.

Arnold Kester
On Tue, 2002-03-19 at 12:15, ripley at stats.ox.ac.uk wrote:
[snip]
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
i am using R 1.5 on solaris 2.8 and redhat 7.2 (what i mention
below happens for all of these and on R-1.4.1 on solaris 2.8)

i am fitting an addtive model (y=roweffect+columneffct+error) to the
following data using rlm

   8.631371  8.219719
  12.407817 12.373610
  10.558580 10.284926
  11.525872 11.504441
  12.644998 12.583985
  12.772225 12.629980
  12.482169 12.271868
  12.039199 12.061671
  11.892378 11.688070
 11.725565 11.655078
 11.251226 11.383293
  9.199893  7.860003
 12.275562 12.240147
 13.638981 13.381291
 13.205941 13.060880
 11.056920 10.707565

if the above matrix is x, when i do the following:
  m <- dim(x)[1]
  n <- dim(x)[2]
  rows<- as.factor(rep(1:m,n))
  cols <- as.factor(rep(1:n,rep(m,n)))
  
  z  <-rlm(as.vector(x)~cols+rows,psi=psi.bisquare)
 
i get an NA in the estimate z$coef[13]

this relates to the 12th row  effect which appears to be an
outlier. is this how one interprets an NA  here?

one consequence is that i cant get standard errors
through summary.rlm(z). is there a "work around" this?


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
1 day later
#
On Tue, 19 Mar 2002, Rafael A. Irizarry wrote:

            
This is the rlm in package MASS, I presume?

There is no `R 1.5' nor will there ever be.  The version of MASS for R
1.5.0 is not yet released (like R 1.5.0).
Since you overrode the default psi, you gave zero weight to all
observations in row 12.  So you have no usable information about row12.
The work-around is to use a statistical method that fits your problem.