Friday, November 18, 2005

Paint with all the colours of the wind


Here's a function I wrote in R to help me pick colours when producing beautiful graphs:

showcol <- function(col) {
co <- colors()[grep(col,colors())]
thickness <- floor(400/length(co))
par(mar=c(1,8,1,1))
par(las=1)
plot(0,0,type="n",xlim=c(0,1),
ylim=c(1,length(co)),axes=FALSE,
xlab="",ylab="")
mtext(co,line=1,side=2,at=1:length(co),cex=0.7)
for (i in 1:length(co)) {
segments(0,i,1,i,col=co[i],lwd=thickness)
}
}

To produce the figure at right, you simply call

showcol("brown")

Some of those don't look all that brown to me ...

P.S. I couldn't figure out how to get Blogger to keep my indentation in the code above, but at least you can copy and paste this directly into R and it works. And I got to learn all about CSS.
Bookmark and Share

1 Comments:

Blogger pakescorts646 said...

Escorts in Pakistan services only employ ladies that are certified and pass our strict requirements. You are our respected client hence why we offer ladies who will leave a permanent impression in any public appearance. Pakistani Escorts have an attractive sexual attraction, and their natural appearance is just too charming to look at.

1:09 PM, June 01, 2018  

Post a Comment

<< Home