[R] altering legend with plot(density(..))

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Mar 1 17:17:17 CET 2005


Brian Hook wrote:

>  On Tue, 01 Mar 2005 16:38:42 +0100, Uwe Ligges wrote:
> 
> 
>>So, can you tell us what is wrong with
>>set.seed(123)
>>plot(density(rnorm(100)))
>>and where the legend is? Maybe you don't like the defaults for
>>"xlab" or "main"?
> 
> 
> Ah, yes, I was confusing xlab with the legend.  Sorry for that.  In
> addition, "legend" wasn't showing up where I expected (beneath xlab)
> -- is there a way to put a legend outside of the graph itself?

So you are using legend() specifying coordinates outside the plot region?

Yes, it work if you set par(xpd=TRUE) before, see ?par.

Uwe Ligges




> Thank you,
> 
> Brian
>




More information about the R-help mailing list