[R] Legend titles in log plots broken? (ver. 2.2.1)

From: Rob Steele <rfin.20.phftt_at_xoxy.net>
Date: Thu 11 May 2006 - 07:53:28 EST


Legend titles work in linear plots:

curve(1/x, xlim = c(0, 1))
legend(x = 'topright', inset = 0.04,

        legend = '1/x', lty = 1,
        title = 'Legend Title')

But when you change to a log plot on either dimension things get screwy:

curve(1/x, xlim = c(0, 1), log = 'y')
legend(x = 'topright', inset = 0.04,

        legend = '1/x', lty = 1,
        title = 'Legend Title')

If you save the value legend() returns you can look at it and see that it's messed up:

l <- legend(x = 'topright', inset = 0.04,

             legend = '1/x', lty = 1,
             title = 'Legend Title')

 > l
$rect
$rect$w

[1] 0.2349272

$rect$h

[1] 0.2727899

$rect$left

[1] 0.7618728

$rect$top

[1] 1.9936

$text
$text$x

[1] 0.9188374

$text$y

[1] 1.81174

 > R.Version()
$platform

[1] "i686-redhat-linux-gnu"

$arch

[1] "i686"

$os

[1] "linux-gnu"

$system

[1] "i686, linux-gnu"

$status

[1] ""

$major

[1] "2"

$minor

[1] "2.1"

$year

[1] "2005"

$month

[1] "12"

$day

[1] "20"

$"svn rev"

[1] "36812"

$language

[1] "R"



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 11 08:14:34 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 12 May 2006 - 06:10:09 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.