Grokbase Groups R r-help March 2002
FAQ
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

--
Met vriendelijke groet,
Arnold Kester

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

Search Discussions

  • Ripley at Mar 19, 2002 at 11:15 am

    On 19 Mar 2002, Arnold Kester wrote:

    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?
    par(xaxs="i", yaxs="i")


    --
    Brian D. Ripley, ripley at stats.ox.ac.uk
    Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
    University of Oxford, Tel: +44 1865 272861 (self)
    1 South Parks Road, +44 1865 272860 (secr)
    Oxford OX1 3TG, UK Fax: +44 1865 272595

    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Arnold Kester at Mar 19, 2002 at 12:08 pm
    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:
    On 19 Mar 2002, Arnold Kester wrote:

    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
    [snip]
    Is there an easier way to get what I want?
    par(xaxs="i", yaxs="i")


    --
    Brian D. Ripley, ripley at stats.ox.ac.uk
    Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
    University of Oxford, Tel: +44 1865 272861 (self)
    1 South Parks Road, +44 1865 272860 (secr)
    Oxford OX1 3TG, UK Fax: +44 1865 272595

    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Ko-Kang Kevin Wang at Mar 19, 2002 at 11:42 am
    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@stat.unimaas.nl>
    To: "r-help" <r-help@stat.math.ethz.ch>
    Sent: Tuesday, March 19, 2002 10:55 PM
    Subject: [R] plot with the axes at xlim and ylim

    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

    --
    Met vriendelijke groet,
    Arnold Kester

    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
    _._
    >



    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Rafael A. Irizarry at Mar 19, 2002 at 2:49 pm
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Ripley at Mar 20, 2002 at 4:25 pm

    On Tue, 19 Mar 2002, Rafael A. Irizarry wrote:

    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
    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).
    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?
    Since you overrode the default psi, you gave zero weight to all
    observations in row 12. So you have no usable information about row12.
    one consequence is that i cant get standard errors
    through summary.rlm(z). is there a "work around" this?
    The work-around is to use a statistical method that fits your problem.

    --
    Brian D. Ripley, ripley at stats.ox.ac.uk
    Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
    University of Oxford, Tel: +44 1865 272861 (self)
    1 South Parks Road, +44 1865 272860 (secr)
    Oxford OX1 3TG, UK Fax: +44 1865 272595

    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-help @
categoriesr
postedMar 19, '02 at 10:55a
activeMar 20, '02 at 4:25p
posts6
users4
websiter-project.org
irc#r

People

Translate

site design / logo © 2017 Grokbase