[R] Legend on graph
gunter.berton at gene.com
Tue Aug 14 00:59:49 CEST 2007
You can get the legend outside the plot region by
1. First changing the clipping region via par(xpd = TRUE) ; (or xpd=NA). see
2. Specifying x and y coodinates for legend placement outside the limits of
the plot region.
This allows you to include a legend without adding a bunch of useless
whitespace to the plot region; or to add a grid to the plot without
interfering with the legend.
Genentech Nonclinical Statistics
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Nguyen Dinh Nguyen
Sent: Monday, August 13, 2007 3:42 PM
To: akkilesha at gmail.com
Cc: r-help at stat.math.ethz.ch
Subject: [R] Legend on graph
Then you may need to increase y-axis scale by ylim=c(min,max)
On 8/12/07, akki <akkilesha at gmail.com> wrote:
> I have a problem when I want to put a legend on the graph.
> I do:
> legend("topright", names(o), cex=0.9, col=plot_colors,lty=1:5, bty="n")
> but the legend is writen into the graph (graphs' top but into the graph),
> because I have values on this position. How can I write the legend on top
> the graph without the legend writes on graph's values.
More information about the R-help