[R] legends in a plot

Gabor Grothendieck ggrothendieck at gmail.com
Fri Sep 22 22:17:30 CEST 2006

If the main thing you want is just to ensure that the legend and
plot are consistent it would be easier to change the plot than
change the legend:

x <- 1:10
plot(x,x^1.5, pch=1)
lines(x, x^1.5,lty=1)
legend(1,25, legend="hello",pch=1, lty=1)

On 9/22/06, Bingshan Li <bli1 at bcm.tmc.edu> wrote:
> Hi there,
> I have the following plot. The circles and the line do not cross in
> the main plot. But in the legend, the circle and the line cross. I am
> wondering if there is a way to make the legend look like the plot
> without crossing. I looked around but did not find a way to do that.
> Is it doable?
> plot(x,x^1.5, pch=1, lty=1, type='b')
> legend(1,25, legend="hello",pch=1, lty=1)
> Thanks and have a great weekend!
> ______________________________________________
> 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.

More information about the R-help mailing list