Re: [R] suppress some boxes drawn by legend(,fill)

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Tue, 22 Jan 2008 16:27:37 -0500 (EST)


It occured to me afterwards that this was not what you wanted. I think Jerome Asselin in
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/15483.html has a solution that may do what you want

Try

legend(3, 0.45, legend = c("x1", "x2", "mean(x1)", "mean(x2)"), pch=c(22,22,30,30),

       col = c("orange", "green"),
pt.bg=c("orange","green","white","white"),

       lty = c(0, 0, 2, 2), merge = T)

> box.lty = 0
>
> assuming I understand the question.
> --- Tom Boonen <tom.boonen.maiden_at_gmail.com> wrote:
>
> > Is there any way suppress box color and frame of a
> > box drawn by
> > legend(,fill)? I am able to suppress the color,
> but
> > not the frame (see
> > the example below). Many thanks! (This follows up
> > from a question
> > asked on the list in 2006 by Florian Koller)
> >
> > Tom
> >
> > x1 <- rnorm(100)
> > x2 <- rnorm(100, 2)
> > hist(x1, main = "", col = "orange",ylab =
> "density",
> > xlab = "x", freq
> > = F, density = 55,xlim = c(-2, 5), ylim = c(0,
> 0.5))
> > par(new = T)
> > hist(x2, main = "", col = "green", ylab = "", xlab
> =
> > "",axes = F, xlim
> > = c(-2, 5), ylim = c(0, 0.5), density = 45, freq =
> > F)
> > abline(v = mean(x1), col = "orange", lty = 2, lwd
> =
> > 2.5)
> > abline(v = mean(x2), col = "green", lty = 2, lwd =
> > 2.5)
> > legend(3, 0.45, legend = c("x1", "x2", "mean(x1)",
> > "mean(x2)"),
> > col = c("orange", "green"),
> > fill=c("orange","green", 0, 0),
> > lty = c(0, 0, 2, 2), merge = T)
> >
> > ______________________________________________
> > R-help_at_r-project.org 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.
> >
>
>
>
> Looking for the perfect gift? Give the gift of
> Flickr!
>
> http://www.flickr.com/gift/
>
>



R-help_at_r-project.org 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. Received on Tue 22 Jan 2008 - 21:31:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Jan 2008 - 22:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive