Grokbase Groups R r-help March 2002
FAQ
Hello,

I'm trying to put a mathematical expression into a legend, but R
complains about a syntax error. Basically i'd like to do this:

legend.text = c(expression(x < 10), expression(x >= 10))

The manual says that one can only pass mathematical expressions to axis,
text etc. but not to the legend command?

Is there a workaround for this?

thanks a lot for help,

Arne

--
Arne Mueller
Biomolecular Modelling Laboratory
Imperial Cancer Research Fund
44 Lincoln's Inn Fields
London WC2A 3PX, U.K.
phone : +44-(0)207 2693405 | fax :+44-(0)207-269-3534
email : a.mueller at icrf.icnet.uk | http://www.bmm.icnet.uk
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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

  • Paul Murrell at Mar 12, 2002 at 11:48 pm
    Hi

    I'm trying to put a mathematical expression into a legend, but R
    complains about a syntax error. Basically i'd like to do this:

    legend.text = c(expression(x < 10), expression(x >= 10))

    The following works for me on 1.4.0 (yukky alignment which should be fixed
    in 1.4.1) ...

    plot(1:20, pch=rep(1:2, c(9, 11)))
    legend(6, 4, c(expression(x < 10), expression(x >= 10)), pch=1:2)

    The manual says that one can only pass mathematical expressions to axis,
    text etc. but not to the legend command?

    Could you let us know where it says that -- sounds like it will need fixing.
    Thanks.

    Paul


    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Arne Mueller at Mar 13, 2002 at 1:31 am

    On Wed, 13 Mar 2002, Paul Murrell wrote:

    Hi

    I'm trying to put a mathematical expression into a legend, but R
    complains about a syntax error. Basically i'd like to do this:

    legend.text = c(expression(x < 10), expression(x >= 10))

    The following works for me on 1.4.0 (yukky alignment which should be fixed
    in 1.4.1) ...
    Hi,

    yes, thanks, the stuff below does what I want. However, the legend text is
    now shifted to the top relative to the symbols of the legend. This
    probably what you mean with 'yukky' alignment? I'm running 1.4.1 :-(
    plot(1:20, pch=rep(1:2, c(9, 11)))
    legend(6, 4, c(expression(x < 10), expression(x >= 10)), pch=1:2)

    The manual says that one can only pass mathematical expressions to axis,
    text etc. but not to the legend command?

    Could you let us know where it says that -- sounds like it will need fixing.
    Thanks.
    I found it under help('plotmath')

    ...
    If the `text' argument to one of the text-drawing functions
    (`text', `mtext', `axis') in R is an expression, the argument is
    interpreted as a mathematical expression and the output will be
    formatted according to TeX-like rules. Expressions can also be
    used for titles, subtitles and x- and y-axis labels (but not for
    axis labels on `persp' plots).
    ...

    it's probably just a misunderstanding, since it doesn't explicitely
    include the legend funtion.

    thanks alot,

    Arne

    Paul

    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Uwe Ligges at Mar 13, 2002 at 7:58 am

    Arne Mueller wrote:
    On Wed, 13 Mar 2002, Paul Murrell wrote:

    Hi

    I'm trying to put a mathematical expression into a legend, but R
    complains about a syntax error. Basically i'd like to do this:

    legend.text = c(expression(x < 10), expression(x >= 10))

    The following works for me on 1.4.0 (yukky alignment which should be fixed
    in 1.4.1) ...
    Hi,

    yes, thanks, the stuff below does what I want. However, the legend text is
    now shifted to the top relative to the symbols of the legend. This
    probably what you mean with 'yukky' alignment? I'm running 1.4.1 :-(
    Paul himself fixed the bug on Feb 12 for R-devel (to be 1.5.0 on April
    29, as far as I know).
    R-1.4.1 was released on Jan 30.

    As a workaround specify the adjustment manually:
    legend(..., adj=c(0, 0.5))

    Uwe Ligges
    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Arne Mueller at Mar 13, 2002 at 2:25 pm

    On Wed, 13 Mar 2002, Uwe Ligges wrote:

    Arne Mueller wrote:
    On Wed, 13 Mar 2002, Paul Murrell wrote:

    Hi

    I'm trying to put a mathematical expression into a legend, but R
    complains about a syntax error. Basically i'd like to do this:

    legend.text = c(expression(x < 10), expression(x >= 10))

    The following works for me on 1.4.0 (yukky alignment which should be fixed
    in 1.4.1) ...
    Hi,

    yes, thanks, the stuff below does what I want. However, the legend text is
    now shifted to the top relative to the symbols of the legend. This
    probably what you mean with 'yukky' alignment? I'm running 1.4.1 :-(
    Paul himself fixed the bug on Feb 12 for R-devel (to be 1.5.0 on April
    29, as far as I know).
    R-1.4.1 was released on Jan 30.

    As a workaround specify the adjustment manually:
    legend(..., adj=c(0, 0.5))
    Hi,

    the 'adj' fixes the problem for me. Thanks a lot. from 1.4.1. directly to
    1.5.0 is a large step in the release number. Are there fundamental
    changes/enhancements? Is there a list of new features etc. on the web?

    thanks,

    Arne

    Uwe Ligges
    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Peter Dalgaard BSA at Mar 13, 2002 at 3:13 pm

    Arne Mueller <mueller@cancer.org.uk> writes:

    From 1.4.1. directly to
    1.5.0 is a large step in the release number.
    Not really. The number changes by 0.1.0 about twice per year, and
    then there are patch releases which increment by 0.0.1, so in
    principle it just means that we didn't have all that much to fix for
    1.4.0. Also, we are shifting the development cycle a couple of months
    this time to avoid having releases just after the end of teaching.
    Are there fundamental
    changes/enhancements? Is there a list of new features etc. on the web?
    The current NEWS file is contained in the daily snapshot, instructions
    for obtaining these are in http://cran.r-project.org/sources.html

    --
    O__ ---- Peter Dalgaard Blegdamsvej 3
    c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
    (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
    ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Prof Brian D Ripley at Mar 13, 2002 at 3:19 pm

    On Wed, 13 Mar 2002, Arne Mueller wrote:

    the 'adj' fixes the problem for me. Thanks a lot. from 1.4.1. directly to
    1.5.0 is a large step in the release number. Are there fundamental
    changes/enhancements? Is there a list of new features etc. on the web?
    Look on developer.r-project.org to see the significance, but as the .1 is
    the patchlevel, it will be an *minor* version increment.

    1.5.0 is not finished yet (it does not go into feature freeze until April
    8). The current list of new features is in the NEWS file in the R-devel
    snapshots available via CRAN.

    --
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Ggrothendieck at Mar 14, 2002 at 3:51 pm
    I was able to find a NEWS file at

    ftp://ftp.stat.math.ethz.ch/Software/R/pub/alpha/NEWS

    however, it only contains updates up to 1.4.1. Is there one
    that includes updates to 1.5.0 or was the one I found the
    one you were referring to?

    I was also able to locate a beautified cvs log at:

    http://developer.r-project.org/R.cvslog.pretty

    Perhaps that was what you were referring to?

    If there is a 1.5.0 NEWS file could you provide the
    precise URL?

    On 13 Mar 2002 at 15:19, Prof Brian D Ripley wrote:
    On Wed, 13 Mar 2002, Arne Mueller wrote:

    the 'adj' fixes the problem for me. Thanks a lot. from 1.4.1. directly to
    1.5.0 is a large step in the release number. Are there fundamental
    changes/enhancements? Is there a list of new features etc. on the web?
    Look on developer.r-project.org to see the significance, but as the .1 is
    the patchlevel, it will be an *minor* version increment.

    1.5.0 is not finished yet (it does not go into feature freeze until April
    8). The current list of new features is in the NEWS file in the R-devel
    snapshots available via CRAN.

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

    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
  • Martin Maechler at Mar 14, 2002 at 4:25 pm
    "ggr" == ggrothendieck <ggrothendieck@yifan.net> writes:
    ggr> I was able to find a NEWS file at
    ggr> ftp://ftp.stat.math.ethz.ch/Software/R/pub/alpha/NEWS

    this is just an (old compatibility) alias for
    ftp://ftp.stat.math.ethz.ch/R/NEWS
    which is identical to
    http://cran.R-project.org/src/base/NEWS

    (and so for all CRAN mirrors),
    and hence the NEWS file of the latest released version.

    ggr> however, it only contains updates up to 1.4.1. Is
    ggr> there one that includes updates to 1.5.0 or was the one
    ggr> I found the one you were referring to?

    As was told here before (and at http://stat.ethz.ch/CRAN/sources.html )
    it's in the daily snapshot, i.e. part of the full source tree,
    o either *in* the daily snapshot which means inside the
    R-devel.tar* file you get from ftp://ftp.stat.math.ethz.ch/Software/R/
    o or you use rsync which also gives you the whole source tree
    of R-devel with NEWS at the top.

    ggr> I was also able to locate a beautified cvs log at:

    ggr> http://developer.r-project.org/R.cvslog.pretty

    ggr> Perhaps that was what you were referring to?

    definitely not.

    ggr> If there is a 1.5.0 NEWS file could you provide the
    ggr> precise URL?

    I have just now added links to the (three) unreleased NEWS files at

    http://stat.ethz.ch/R-alpha/

    or for R-devel directly at

    http://stat.ethz.ch/R-alpha/R-devel/NEWS

    I hope this helps.
    However BEWARE: `Unrelased' means that these NEWS files will not
    only be updated before release, but there is no
    strict warranty that a release really will
    contain the features mentioned.

    ggr> On 13 Mar 2002 at 15:19, Prof Brian D Ripley wrote:
    On Wed, 13 Mar 2002, Arne Mueller wrote:
    >>
    the 'adj' fixes the problem for me. Thanks a lot. from
    1.4.1. directly to > 1.5.0 is a large step in the release
    number. Are there fundamental > changes/enhancements? Is
    there a list of new features etc. on the web?
    >>
    Look on developer.r-project.org to see the significance,
    but as the .1 is the patchlevel, it will be an *minor*
    version increment.
    >>
    1.5.0 is not finished yet (it does not go into feature
    freeze until April 8). The current list of new features
    is in the NEWS file in the R-devel snapshots available
    via CRAN.
    >>
    --
    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
    _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
    >>


    ggr> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    ggr> r-help mailing list -- Read
    ggr> http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send
    ggr> "info", "help", or "[un]subscribe" (in the "body", not
    ggr> the subject !) To: r-help-request at stat.math.ethz.ch
    ggr> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
    -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    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 12, '02 at 10:23p
activeMar 14, '02 at 4:25p
posts9
users8
websiter-project.org
irc#r

People

Translate

site design / logo © 2017 Grokbase