[R] Legend outside plot => grid not limited to plot

Peter Mueller t.peter.Mueller at gmx.net
Fri Aug 1 23:10:44 CEST 2008


Hi dear R users,

i would like to have:
1. the legend outside of the plot and 
2. add a grid to the plot.

For 1. I found a example in the R mailinglist archive [1].
1: http://tolstoy.newcastle.edu.au/R/help/06/01/19423.html
The total example code would be:

> ?par
> par(xpd=T, mar=par()$mar+c(0,0,0,4))
> plot(1,1)
> legend(1.5,1,"point",pch=1)
> grid(NULL,NULL,lwd=1)

But the problem now is that the grid is not limited to the plot area. Thge grid is drawn all over the image :-( .
(Try the example if you don't believe me :-) ).

How do I have to correct the code?

Thanks for any hints,
Peter


-- 

http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196



More information about the R-help mailing list