[R] legend at fixed distance form the bottom

Gabor Grothendieck ggrothendieck at gmail.com
Sat Dec 6 18:16:32 CET 2008


Its independent of the scale of the graph.

On Sat, Dec 6, 2008 at 12:07 PM, Christophe Genolini
<cgenolin at u-paris10.fr> wrote:
> Lol.
> To me, a "fixed amount" that depends on the size of the graph is not much
> fixed...
>
> --- 8< ---
>
> symboles <- c(3,4,5,6)
> dn <- rbind(matrix(rnorm(20),,5),matrix(rnorm(20,2),,5))
> listSymboles <- rep(symboles,each=2)
>
> layout(matrix(c(1,1,1,2,2,3),3))
> for(i in 1:3){
>  plot(dn)
>  legend("top", pch = unique(listSymboles), legend = c("a",
> "b","c","d"),inset = c(0,1.1), horiz = TRUE, xpd = NA)
> }
>
> --- 8< ---
> On this example, it is easy to see that index is at a fixed distance from
> the bottom but that Legend is at a distance "porportional"
>
>
>>> I would like to add a legend under a graph but at a fixed distance from
>>> the graphe"
>>>
>>
>> The top of the legend is always a fixed amount below the graph (which is
>> what you asked for).
>>
>>
>
>



More information about the R-help mailing list