[R] Legend on graph

jim holtman
Sun, 12 Aug 2007 18:22:35 -0000

If you are asking to have the values plotted on top of the legend,
then you can do the following:

plot(x, y, type='n', ...) # create plot, but don't plot
legend('topright', ...)
lines(x,y)  # now plot the data

If you want it outside the plot, check the archives for several examples.

On 8/12/07, akki <akkilesha at gmail.com> wrote:
> Hi,
> 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.
>
> Thanks.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?