[R] distance between legend title and legend box

Denis Chabot chabotd at globetrotter.net
Thu Oct 26 15:41:56 CEST 2006


Hi,

I've looked at the parameters available for the legend function and  
cannot find a way to change the distance between the top of the box  
surrounding a legend and the legend's title. I have a math expression  
that raises the height of my title.

If you don't mind the non-sensical title I give to the legend for  
this plot (Figure 3.20 in R Graphics):

with(iris,
       plot(Sepal.Length, Sepal.Width,
            pch=as.numeric(Species), cex=1.2))
legend(6.5, 4.2, c("setosa", "versicolor", "virginica"),
       cex=1, pch=1:3, title=expression("kg/km"^2))

The result depends on the device, but I think any device will show  
the box needs to be raised a bit (in quartz, the top of the box  
passes in the middle of the "2", in pdf it is acceptable, but just  
(the top of the box lightly touches the top of the "2").

Sincerely,

Denis Chabot



More information about the R-help mailing list