[Rd] Help page of colors() : add a new example ?

From: Millot Gael <Gael.Millot_at_curie.fr>
Date: Mon, 30 Jan 2012 14:46:55 +0000

Dear all,

May I suggest to add an example in the help page of the colors() function ? The following code could be useful to easily choose any color from colors() :

## Millot G. (2011), p.71.
## Figure displaying all the 657 built-in color names of colors().
for(i in 14:1){tempo<-c(tempo, rep(i,50))} windows(width=10) # replace by quartz(width=10) for MacOS and by X11(width=10) for Linux par(ann=FALSE, xaxt="n", yaxt="n", bty="n") plot(rep(1:50,14)[1:657], tempo[1:657], pch=22, bg=1:657, cex=1.5, bty="n") par(xpd=TRUE)

axis(side=2, at=14:1, labels=, cex.axis=1.5, srt=90)
text(rep(-2, 14), 14:1, as.character((0:13)*50+1), srt=0, cex=1)
text(c(10,20,30,40,50), rep(-0.5,5), c(10,20,30,40,50), srt=0, cex=1)

## palette(colors()) allow to replace the color names by the numbers indicated
## in the figure.

plot(1, col=630, pch=16, cex=10) # 630 is "tomato"

This code comes from the page 71 of the book I published in french: Millot G. Comprendre et réaliser les tests statistiques à l'aide de R, 2nd edition. De Boeck editions, Bruxelles . 2011, 767 pages.

I wrote it since my students usually complain about the difficulty to select a color from colors() when the names are displayed.

Kind regards,

Gael Millot.

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 30 Jan 2012 - 15:31:50 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Mon 30 Jan 2012 - 19:20:13 GMT.

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

list of date sections of archive