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

Rob Steele rfin.20.phftt at xoxy.net
Wed May 10 23:53:28 CEST 2006


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"




More information about the R-help mailing list