Prasanna wrote:

> Dear Rs
> 
> I have a 3x3 multiple plot. I would like to have a overall legend in
> the outer right margin.
>>From the help archive, I found that it can be done by setting
> par(xpd=NA). However, I couldn't find the correct values
> for x and y co-ordinates for the legend. Please find the code snippet below:
> 
> par(mfrow=c(3,3), mar=c(4,4,0.9,0.5), oma=c(1,2,2,4),cex.main=1.1)
> 
>   *postscript(*file=epsfile,onefile=FALSE,horizontal=TRUE*)*
> 
> /* some plotting */
> 
> par(xpd=NA)

You get the user coordinates of the plotting region by
   par("usr")
Now simply make the legend right of that plotting region, e.g. with
x corrdinates at
   par("usr")[2] + epsilon
and y coordinates at
   mean(par("usr")[3:4])

Uwe Ligges



> legend(legend=c("2h-opt Exact","1-shift Exact","2p-opt Exact"),
> lty=c("solid","dashed","dotdash"),lwd=c(2,2,2),col=c("red","green","black"),
> bty="n",cex=0.8)
> 
> Thanks in advance
> Prasanna
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to